Small tutorial about the static ip in Freebsd (10)
My internal network details are as follow:
Address: 192.168.0.103 netmask: 255.255.255.0 gateway: 192.168.0.1 DNS1: 192.168.0.122 domain: domain.com (changed for privacy reasons) *** I use vmxnet 3 adapter from ESXi 5.* ***
We’re going to work in the standard config files
/etc/rc.conf (networking)
/etc/resolv.conf (DNS)
Step 1:
ee is the default editor in freebsd.
ee /etc/rc.conf
Standard the file has the following settings:
hostname = zfsguru.bsd ifconfig_default=DHCP #ifconfig_em0=inet 10.0.0.101 netmask 255.255.255.0 #defaultrouter = 10.0.0.1
Change those to: (please use your own network settings)
hostname = aristoteles.domain.com #ifconfig_default=DHCP #ifconfig_em0=inet 10.0.0.101 netmask 255.255.255.0 ifconfig_vmx0=inet 192.168.0.103 netmask 255.255.255.0 defaultrouter=192.168.0.1
Step 2: editing resolv.conf
ee /etc/resolv.conf
#generated by resolvconf search domain.com nameserver 192.168.0.122
Step 3: restart networking and routing
/etc/rc.d/netif restart /etc/rc.d/routing stop /etc/rc.d/routing start
Step 4: Results
[root@aristoteles /home/ssh]# ifconfig vmx0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=60039b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,TSO6,RXCSUM_IPV6,TXCSUM_IPV6> ether 00:0c:29:0a:04:11 inet 192.168.0.103 netmask 0xffffff00 broadcast 192.168.0.255 inet6 fe80::20c:29ff:fe0a:411%vmx0 prefixlen 64 scopeid 0x1 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect status: active lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
[root@aristoteles /home/ssh]# cat /etc/resolv.conf # Generated by resolvconf search domain.com nameserver 192.168.0.122