Adding Ip Address
cd /etc/sysconfig/network-scripts
make a backup of the file
cp ifcfg-eth0 ifcfg-eth0.bak
Then copy the config for your new IP
cp ifcfg-eth0 ifcfg-eth0:1
Then edit the new config
pico -w ifcfg-eth0:1
The lines you need to change:
DEVICE="eth0"
to
DEVICE="eth0:1"
Then change the
IPADDR="xxx.xxx.xxx.xxx"
to be your NEW ip address
Save the configuration file.
• This should also restart eth0:1 on a reboot as it’s a direct copy of the eth0 config. So checking for the ONBOOT="yes" in ifcfg-eth0:1 will ensure it DOES come back up on a reboot.
Done!
/sbin/ifup eth0:1
Testing:
[root@station3 mysql-5.0.41]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:02:55:7F:98:C0
inet addr:192.168.129.104 Bcast:192.168.129.255 Mask:255.255.255.0
inet6 addr: fe80::202:55ff:fe7f:98c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:658827 errors:0 dropped:0 overruns:0 frame:0
TX packets:242728 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:221181956 (210.9 MiB) TX bytes:40499967 (38.6 MiB)
eth0:1 Link encap:Ethernet HWaddr 00:02:55:7F:98:C0
inet addr:192.168.129.105 Bcast:192.168.129.255 Mask:255.255.255.0
inet6 addr: fe80::202:55ff:fe7f:98c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:658827 errors:0 dropped:0 overruns:0 frame:0
TX packets:242728 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:221181956 (210.9 MiB) TX bytes:40499967 (38.6 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2831 errors:0 dropped:0 overruns:0 frame:0
TX packets:2831 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2422769 (2.3 MiB) TX bytes:2422769 (2.3 MiB)
No comments:
Post a Comment