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 :

1
cd /etc/sysconfig/network-scripts
1
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).

1
2
3
4
5
6
7
8
9
10
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:

1
cp ifcfg-eth0 ifcfg-eth0:0

Edit configuration file :

1
vi ifcfg-eth0:0

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

1
2
3
4
5
6
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:

1
cp ifcfg-eth0 ifcfg-eth0:0

Edit configuration file :

1
vi ifcfg-eth0:0

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

1
2
3
4
5
6
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

1
service network restart

u can check the configuration using ‘ifconfig’ commend.

done!

原文链接:https://xiaohost.com/2567.html,转载请注明出处。
0

评论0

请先