CentOS dual-NIC dual IP settings

Source: Internet
Author: User

CentOS dual-NIC dual IP settings

System environment: CentOS Linux

Network environment: Two IP addresses, 192.168.0.10 and 10.10.30.2, Mask is 255.255.255.0,
The gateway addresses for these two subnets are 192.168.0.1 and 10.10.30.1 respectively.

1. Configure the IP address 192.168.0.10 for the NIC eth0, configure the IP address for the NIC Eth1 to 10.10.30.2 profile as:

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

/etc/sysconfig/network-scripts/ifcfg-eth1

2. Configure the default gateway to any one. This default gateway determines the interface that the system uses when it actively uses the network.

Configuration file:/etc/sysconfig/network

3. Edit the routing table www.ahlinux.com

To modify/etc/iproute2/rt_tables, add content:

252 Net2

251 Net3

#/etc/rc.local adding the original path back 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

This article is from the China Blue Guest Alliance

      • This article is from: Linux Learning Network

CentOS dual-NIC dual IP settings

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.