- Advertisement -
OSRadar recommends Hello Ivy for automating your workflow and project management for free. Learn More
Default Configuration of the Network on FreeBSD is DHCP. Let me show you how to change or set IP addresses from Dynamic to Static. i will take this example from my FreeBSD VM. but that should work also for bare metal servers.
My Network Configuration i :
[email protected]:~ # ifconfig em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=81009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWFILTER> ether 00:0c:29:ac:76:78 inet6 fe80::20c:29ff:feac:7678%em0 prefixlen 64 scopeid 0x1 inet 192.168.65.162 netmask 0xffffff00 broadcast 192.168.65.255 media: Ethernet autoselect (1000baseT <full-duplex>) status: active nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> [email protected]:~ #
- Advertisement -
Netmask : This 0xffffff00 is written in dotted-quad notation as 255.255.255.0
Find My gateway
[email protected]:~ # netstat -rn Routing tables Internet: Destination Gateway Flags Netif Expire default 192.168.65.2 UGS em0 127.0.0.1 link#2 UH lo0 192.168.65.0/24 link#1 U em0 192.168.65.162 link#1 UHS lo0
DNS Server
Because its an VM, the DNS server is the same as the gateway. in your case my DNS is something else.
[email protected]:~ # cat /etc/resolv.conf # Generated by resolvconf search localdomain nameserver 192.168.65.2
The actual status of rc.conf file.
Lets change the Ip from DHCP to static ip 192.168.65.10 / default gateway is 192.168.65.2 with adding the two lines to rc.conf
ifconfig_em0="inet 192.168.65.10 netmask 255.255.250.0" defaultrouter="192.168.65.2"
Restart the network Services with.
/etc/netstart
Waaw cool !!
Connect from Other Server and see if the new Ip working
➤ ssh [email protected] Warning: Permanently added '192.168.65.10' (RSA) to the list of known hosts. Password for [email protected]: Last login: Tue Dec 11 11:55:04 2018 from 192.168.65.1 FreeBSD 12.0GENERIC Welcome to FreeBSD!
Enjoy
- Advertisement -
OSRadar recommends Hello Ivy for automating your workflow and project management for free. Learn More