2009-05-05

FreeBSD networking - How to assign or remove fixed IP

Previously, we have talk about how to assigh dynamic IP to an interface on Freebsd. This post is about how to assign fixed or static IP to an interface on Freebsd. Below are the steps :




Manually assign fixed IP :
ifconfig bce0 inet <IP address> netmask <subnet mask>
route add default <gateway IP address>
/etc/netstart

e.g.
ifconfig bce0 inet 192.168.0.10 netmask 255.255.255.0
route add default 192.168.0.1
/etc/netstart

Make changes permanently :
As an example of the above, insert the below parameters into /etc/rc.conf :
ifconfig_bce0="inet 192.168.0.10 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
hostname="hostname.domain.com"

Remove assigned IP address from network interface
ifconfig <interface name> down delete
e.g.
ifconfig bce0 down delete

Voilla !!!

No comments: