Intranet non-routed cross-network service--single NIC dual IP configuration

Source: Internet
Author: User

Sometimes, in our intranet service, if you do not want to use the routing function, but also want to let some servers across the network services, then, it is necessary to configure the server network card multiple IP address, so that it can provide multiple network access, then the Linux how to implement, today to share.


Operation Steps

1. CP eth0 eth0:1 Copy the NIC interface profile to a name eth0:1

2. Modify the specific configuration information of the NIC

Note: Eth0 can be configured statically with DHCP

Eth0:1 can only be configured with static

Since we are the server, of course, two configurations use static IP is the best

3. Restart the Network service (to ensure that the NetworkManager service is in a stopped state)

4. Verify the final effect


Step one: CP eth0 eth0:1 Copy the NIC interface configuration file to a name eth0:1

[email protected] network-scripts]# CP Ifcfg-eth0 ifcfg-eth0:1


Step Two: Modify the specific configuration information of the NIC

[Email protected] network-scripts]# vim Ifcfg-eth0

[email protected] network-scripts]# cat Ifcfg-eth0

Device=eth0

Bootproto=none

ipaddr=10.1.253.253

Prefix=16

[email protected] network-scripts]# cat ifcfg-eth0:1

Device=eth0:1

Bootproto=none

ipaddr=192.168.253.253

Prefix=24

[Email protected] network-scripts]#


Step Three: Restart the Network Service (to ensure that the NetworkManager service is in a stopped state)

Note the system will turn on the NetworkManager service by default, if you want to enable the single-NIC dual IP, it is best to close it, otherwise it will not take effect

[[Email protected] network-scripts]# service NetworkManager status

NetworkManager is stopped


[Email protected] network-scripts]# service network restart

Shutting down interface eth0: [OK]

Shutting down loopback interface: [OK]

Bringing up loopback interface: [OK]

Bringing up interface eth0:determining if IP address 10.1.253.253 are already in use for device eth0 ...

Determining if IP address 192.168.253.253 is already on use for device eth0 ...

[OK]


[Email protected] network-scripts]# ifconfig

Eth0 Link encap:ethernet HWaddr 00:0c:29:c8:72:26

inet addr:10.1.253.253 bcast:10.1.255.255 mask:255.255.0.0

Inet6 ADDR:FE80::20C:29FF:FEC8:7226/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:1185 errors:0 dropped:0 overruns:0 frame:0

TX packets:366 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:107195 (104.6 KiB) TX bytes:38655 (37.7 KiB)


Eth0:1 Link encap:ethernet HWaddr 00:0c:29:c8:72:26

inet addr:192.168.253.253 bcast:192.168.253.255 mask:255.255.255.0

Up broadcast RUNNING multicast mtu:1500 metric:1


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:65536 metric:1

RX packets:260 errors:0 dropped:0 overruns:0 frame:0

TX packets:260 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:18160 (17.7 KiB) TX bytes:18160 (17.7 KiB)


[Email protected] network-scripts]#


Fourth step: Verify the final effect, from Centos7 to PINGCENTOS6 on the dual IP configured

[Email protected] network-scripts]# ifconfig

Eno16777728:flags=4163<up,broadcast,running,multicast> MTU 1500

inet 10.1.254.254 netmask 255.255.0.0 broadcast 10.1.255.255

Inet6 fe80::20c:29ff:fe06:f987 Prefixlen ScopeID 0x20<link>

Ether 00:0c:29:06:f9:87 Txqueuelen (Ethernet)

RX packets 133425 Bytes 10462696 (9.9 MiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 61400 Bytes 6585145 (6.2 MiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


Eno16777728:1: Flags=4163<up,broadcast,running,multicast> MTU 1500

inet 192.168.253.254 netmask 255.255.255.0 broadcast 192.168.253.255

Ether 00:0c:29:06:f9:87 Txqueuelen (Ethernet)


Lo:flags=73<up,loopback,running> MTU 65536

inet 127.0.0.1 netmask 255.0.0.0

Inet6:: 1 prefixlen ScopeID 0x10

Loop Txqueuelen 0 (Local Loopback)

RX Packets 2496 Bytes 234576 (229.0 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX Packets 2496 Bytes 234576 (229.0 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


[Email protected] network-scripts]# ping-c 4 10.1.253.253

PING 10.1.253.253 (10.1.253.253) bytes of data.

Bytes from 10.1.253.253:icmp_seq=1 ttl=64 time=3.41 ms

Bytes from 10.1.253.253:icmp_seq=2 ttl=64 time=0.536 ms

Bytes from 10.1.253.253:icmp_seq=3 ttl=64 time=0.539 ms

Bytes from 10.1.253.253:icmp_seq=4 ttl=64 time=0.738 ms


---10.1.253.253 ping statistics---

4 packets transmitted, 4 received, 0% packet loss, time 3029ms

RTT Min/avg/max/mdev = 0.536/1.306/3.413/1.219 ms

[Email protected] network-scripts]# ping-c 4 192.168.253.254

PING 192.168.253.254 (192.168.253.254) bytes of data.

Bytes from 192.168.253.254:icmp_seq=1 ttl=64 time=0.135 ms

Bytes from 192.168.253.254:icmp_seq=2 ttl=64 time=0.126 ms

Bytes from 192.168.253.254:icmp_seq=3 ttl=64 time=0.126 ms

Bytes from 192.168.253.254:icmp_seq=4 ttl=64 time=0.128 ms


---192.168.253.254 ping statistics---

4 packets transmitted, 4 received, 0% packet loss, time 3017ms

RTT Min/avg/max/mdev = 0.126/0.128/0.135/0.014 ms

[Email protected] network-scripts]#

As you can see, two IP addresses can be ping through, so if it is cross-network service, single-NIC dual-IP effect is reflected.


This article is from the "Love Firewall" blog, be sure to keep this source http://183530300.blog.51cto.com/894387/1846131

Intranet non-routed cross-network service--single NIC dual IP configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.