Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i change the IP, subnet mask and default gateway on freeBSD 1

Status
Not open for further replies.

linuxMaestro

Instructor
Jan 12, 2004
183
US
How do i change the IP, subnet mask and default gateway on my freeBSD box?
 
Hi,

USe "ifconfig" command. Example:

ifconfig xl0 10.10.10.10 netmask 255.255.0.0 broadcast 10.10.255.255

For default gateway you can use:

route add default 10.200.20.1

Make sure nothing set for default gateway first. Use "netstat" command to check your default gateway. Example:

netstat -rn



dbase77
 
I already have a default gateway set, what is the easiest way to change that?
 
Hi,

Remove the line by issuing:

route delete default

Then issue the command I gave you for adding default gateway.

dbase77

 
Thanks, but I got an error saying
couldn't find device xl0

when I ran
ifconfig xl0 10.10.10.10 netmask 255.255.0.0 broadcast 10.10.255.255

got any tips?
 
Hi,

device xl0 is just for example. You need to put in your own device name. Run "ifconfig -a" or "dmesg" to find out your device name.

dbase77
 
Thanks that worked, but once I rebooted it reverted back to the old IP, subnet and gateway.

How can I change it permenantly?
 
Hi,

Put these lines in file "/etc/rc.conf":

ifconfig_xl0="inet 10.200.10.33 netmask 255.255.0.0"
defaultrouter="10.200.20.1"

Make sure you use your own device name and ip address. It wont change when you reboot.

dbase77
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top