Centos dual-nic Dual IP settings

Source: Internet
Author: User

System Environment: centos Linux

Network Environment: two IP addresses, 192.168.0.10 and 10.10.30.2, mask 255.255.255.0,

The Gateway addresses of the two subnets are 192.168.0.1 and 10.10.30.1.

 

1.Configure the IP address 192.168.0.10 for the network adapter eth0 and the IP address 10.10.30.2 for the network adapter eth1. The configuration file is:

/Etc/sysconfig/network-scripts/ifcfg-eth0

/Etc/sysconfig/network-scripts/ifcfg-eth1

 

2.Set the default gateway to any one. This default gateway determines the interface used when the system takes the initiative to use the network.

Configuration File:/etc/sysconfig/Network

Modify the following content

Networking = Yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used)

Hostname = centos (set the Host Name of the local machine. The host name set here must correspond to the host name set in/etc/hosts)

Gateway = 192.168.0.1 (set the IP address of the default gateway connected to the local machine .)


3.Edit route table

1. Modify/etc/iproute2/rt_tables and add the following content:

252 net2

251 net3


2. #/etc/rc. Local Add the original return route

IP Route flush table net2

IP Route add default via 192.168.0.1 Dev eth0 SRC 192.168.0.10 table net2

IP rule add from 192.168.0.10 table net2

IP Route flush table net3

IP Route add default via 10.10.30.1 Dev eth1 SRC 10.10.30.2 table net3

IP rule add from 10.10.30.2 table net3


Related Article

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.