0

I would like to change my ip address and subnet mask with the following command: ifconfig eth1 192.168.1.2 netmask 255.255.255.0 up

and

route add default gw 192.168.1.1

when I reboot my linux it's gone. I would like to keep it permanent with this command. is it possible?

Thanks

3 Answers 3

1

If you don't want the sys V way, you can add

/sbin/route add default gw 192.178.1.1

to /etc/rc.d/rc.local . Although, editing the initi scripts as qweet points out is better.

3

The ifcfg script contains permanent details of your internet devices. You can find them in /etc/sysconfig/network-scripts/ifcfg-<devicetype><num>. There, you should alter/add the following to ifcfg-eth1:

BOOTPROTO=static
IPADDR=192.168.1.2 
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

Which should do the trick. To see the changes in effect, do a sudo /etc/init.d/network restart

0

maybe this link will help. static IP tutorial

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .