How to bind 2 or more IP addresses on a network card

xiaoxiao2021-03-06  43

1. Enter the directory: [root @ LinuxSir root] # CD / etc / sysconfig / network-scripts / 2: IFCFG-EH0: 0 EH0: 0 is the code of the NIC, of ​​course, you can also use EH0: 1 How do you like it, but you must have IFCFG before EH0: X, which is the following form, we take EH0: 0 as an example. [root @ Linuxsir root] #CP ifcfg-eth0 IFCFG-ETH0: 03, Edit IFCFG-Eth0: 0 [root @ Linuxsir root] # vi ifcfg-eth0: 0iFCFG-ETH0: 0 There is such content, you can set this , Then IP can be set yourself. Like I set up like this. # Please read /usr/share/doc/initscripts-*/sysconfig.txt# for the documentation of these parameters.userctl = 'no'netmask =' 255.255.255.0 '- "Submasking bootproto =' static '-" protocol Device = 'eth0: 0' - "Ipaddr = '192.168.0.9' -" I set it myself iptype = 'ethernet'onboot =' yes' - "Don't activate NetWork = '192.168.0.0' - "Domain Broadcast = '192.168.0.255' -" Broadcast 4. Save Exit, then run the following command to activate the virtual network card. [root @ Linuxsir root] # iFUP EH0: 05. Let's see our virtual network card is activated, using ifconfig, that is, the following.

[Root @ Linuxsir network-scripts] # ​​ifconfigeth0 Link encap: Ethernet HWaddr 00: E0: 4C: 00: C9: 05inet addr: 192.168.0.1 Bcast: 192.168.0.255 Mask: 255.255.255.0UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1RX Packets: 3 Errors: 0 Dropped: 0 Overruns: 0 Frame: 0TX Packets: 54 errors: 0 Dropped: 0 Overruns: 0 Trarier: 0Collisions: 0 TXQUEUELEN: 100RX BYTES: 180 (180.0 B) TX bytes: 7157 (6.9 kb ) Interrupt: 11 Base address: 0x2000eth0: 0 Link encap: Ethernet HWaddr 00: E0: 4C: 00: C9: 05inet addr: 192.168.0.9 Bcast: 192.168.0.255 Mask: 255.255.255.0UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1Interrupt: 11 Base address: 0x2000lo Link encap: Local Loopbackinet addr: 127.0.0.1 Mask: 255.0.0.0UP LOOPBACK RUNNING MTU: 16436 Metric: 1RX packets: 12 errors: 0 dropped: 0 overruns: 0 frame: 0TX packets: 12 errors : 0 Dropped: 0 overruns: 0 Carrier: 0Collisions: 0 TXQUEELEN: 0RX BYTES: 846 (846.0 B) TX BYTES: 846 (846.0 B) 6.PING IP, you can know if we do is successful.

转载请注明原文地址:https://www.9cbs.com/read-86481.html

New Post(0)