Showing posts with label ip. Show all posts
Showing posts with label ip. Show all posts

Sunday, December 6, 2009

How to set up (create) an alias ip for an interface in FreeBSD

You can easily set up an alias ip alias for an interface using the command line utility ifconfig .

The bellow command shows how to set an alias ip to the interface rl0.
# ifconfig rl0 192.168.3.1 netmask 255.255.255.255 alias
Substitute rl0 with your desired inteface and 192.168.3.1 with your desires ip.
Now if you want this configuration to be "persistent across boot" then you will need to edit the file /etc/rc.conf to setup persistent ip aliasing option by appending a configuration line, so that next time FreeBSD comes up (after restart/shutdown) it will create alias for you:
Open the file
# vi /etc/rc.conf
Append the following line.
ifconfig_rl0_alias0="inet 192.168.3.1 netmask 255.255.255.255"
replace rl0 and 192.168.3.1 with your desired values.

Friday, December 4, 2009

How to create a Permanent or Static ip in Freebsd

You can add an ip to an interface after boot using ifconfig.
example: ifconfig rl0 192.168.1.1
But this ip wont last for the next boot.

So if you want to make an permanent ip for an interface just follow these steps.

1. Open up the file rc.conf
# vi /etc/rc.conf
2. Now add the following line
ifconfig_interface="inet 192.168.1.1 netmask 255.255.255.0"  
substitute interface with your interface(eg:rl0,rl1,fxp0,em0..)
substitute 192.168.1.1 with your desired lan ip.
Now type <ESC>:wq to save and exit
3. Now Restart your network.
# /etc/rc.d/netif restart && /etc/rc.d/routing restart

 
 

Labels

Labels