RHEL6.1 configure a vro shared network

Source: Internet
Author: User
RedHatLinux vro configuration experiment: Set the Linux server installed with rhel6.1 as a vro to achieve network sharing. Two NICs eth0: internal network eth1: Internet are required. First, describe the network structure Internet: for the company's office network, the IP address of eth1 is 192.168.0.115, and the Intranet of the gateway 192.168.0.1 is a virtual network in the virtual machine architecture. The IP address is 192.168.2.1 gateway 192.168.2.11. /etc/

RedHat Linux router configuration experiment:

Set the Linux server installed with rhel 6.1 As a router to achieve network sharing. Two NICs are required.
Eth0: internal network
Eth1: Internet

First, describe the Network Structure
Internet: office network, eth1 IP address 192.168.0.115, Gateway 192.168.0.1
Intranet: a virtual network in the virtual machine architecture. The IP address is 192.168.2.1, And the gateway is 192.168.2.1.

1./etc/sysconfig/network
NETWORKING = yes
HOSTNAME = manager. localhost # server name
GATEWAY = 192.168.0.1 # Internet GATEWAY
GATEWAYDEV = eth1 # Device Used as the Internet gateway
FORWARD_IPV4 = yes

2. Nic device eth1 Configuration
/Etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE = eth1 # DEVICE code
BOOTPROTO = static # IP Address Configuration Method
IPADDR = 192.168.0.115 # Internet ip Address
TYPE = Ethernet
HWADDR = 00: 0c: 29: 0a: 43: 4d
PEERDNS = yes
ONBOOT = yes # boot

3. Configure eth0 for the Intranet Nic Device
/Etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
HWADDR = 00: 0c: 29: 0a: 43: 43
NM_CONTROLLED = yes
ONBOOT = yes
IPADDR = 192.168.2.1 # Intranet ip Address
BOOTPROTO = none
NETMASK = 255.255.255.0
TYPE = Ethernet
GATEWAY = 192.168.0.115 # Intranet GATEWAY, consistent with the Internet ip Address
GATEWAYDEV = eth1 # device that acts as an intranet Gateway
IPV6INIT = no
USERCTL = no

4. Configure iptables
Service iptables stop
Iptables-t nat-a postrouting-o eth0-j MASQUERADE
Iptables-a forward-s 192.168.2.0/24-j ACCEPT
Iptables-a forward-d 192.168.2.0/24-j ACCEPT
Iptables-a forward-s! 192.168.2.0/24-j DROP
Service iptables save # save configuration information
Service iptables start # restart iptables

5. Restart Related Services
Service network restart
Service iptables restart

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.