Centos-How to configure multiple IPs for a single network card ?

暂无评论 本文标签:

setp 1
login to your linux Server as root account via ssh tunnel.

setp 2
Enter the directory where the configuration file is located.

Using the commend :


cd /etc/sysconfig/network-scripts
cat ifcfg-eth0

The files ifcfg-eth0 is the default IP configuration.
The following information is usually displayed on your xshell's interface after u used the 'cat ifcfg-eth0' commend (u can using other ssh tools..e.g putty).

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.1
NETMASK=255.255.255.0
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFAULTGW=2610:0150:c002:0000:0000:0000:0a00:0001
IPV6ADDR_SECONDARIES="2610:150:c002::af9f:6854/120"

aaa.aaa.aaa.aaa is the server's default public IP
aaa.aaa.aaa.1 is the server's default gateway
Attention:
'IPV6INIT=no' may cause you fail to log in to the server through ssh.
It looks like a timeout. At this point, you need to log in to the server using VNC. Modify the configuration parameter to no.
How do I find where VNC is ? VNC generally provided by the host,but u need to download software called 'VNC viewer' from https://www.realvnc.com/en/connect/download/viewer/windows/
and look for your VNC's IP & password &port on your server's console,for more information,please visit the site https://www.realvnc.com/

step 3
Bind the first extra IP address bbb.bbb.bbb.bbb to the network card eth0.

Copy the files ifcfg-eth0 to ifcfg-eth0:0 using the commend:

cp ifcfg-eth0 ifcfg-eth0:0

Edit configuration file :

vi ifcfg-eth0:0

Write the following configuration into the files 'ifcfg-eth0:0' and save.

DEVICE=<strong>eth0:0</strong>
BOOTPROTO=static
ONBOOT=yes
IPADDR=bbb.bbb.bbb.bbb
GATEWAY=bbb.bbb.bbb.1
NETMASK=255.255.255.0

step 4
Bind second extra IP addresses.
Copy the files ifcfg-eth0 to ifcfg-eth0:1 using the commend:

cp ifcfg-eth0 ifcfg-eth0:0

Edit configuration file :

vi ifcfg-eth0:0

Write the following configuration into the files 'ifcfg-eth0:0' and save.

DEVICE=<strong>eth0:1</strong>
BOOTPROTO=static
ONBOOT=yes
IPADDR=ccc.ccc.ccc.ccc
GATEWAY=ccc.ccc.ccc.1
NETMASK=255.255.255.0

setp 5
Repeat the process above...
Restart the server's network process after you finishe it

service network restart

u can check the configuration using 'ifconfig' commend.

done!