For details about how to use Redhat as a router-Linux Enterprise Application-Linux server application, see the following. Many netizens say that NAT is always unsuccessful when using RH for routing. I think there are three points.
1. It may be that iptables is not well written (most of the Netizens are iptables problems)
2. Incorrect configuration (for example, modifying the IP address of the NIC)
3. I have never done it, and I have no idea how to learn it.
Okay.
Now, let's start with red hat routing.
First, we have installed red hat on a machine ).
Then we need to modify eight files. The names of these eight files are:
Network
Ifcfg-eth1
Ifcfg-eth0
Hosts
Sysctl
Static-routes
Rc. local
Resolv
These eight files are very important and must be changed!
The directories corresponding to these eight files are:
/Etc/sysconfig/network
/Etc/sysconfig/network-scripts/ifcfg-eth0
/Etc/sysconfig/network-scripts/ifcfg-eth1
/Etc/hosts
/Etc/sysconfig/static-routes
/Etc/rc. d/rc. local
/Etc/sysctl. conf
We recommend that you use the VI editor to modify the settings!
What do these eight files mean? The following are the functions of these eight files!
Network Master network settings file
Ifcfg-eth0 eth0 Nic settings file
Ifcfg-eth1 eth1 Nic settings file
Hosts network host name Configuration
Static-routes static route table File
Rc. local IPTABLES script (key)
Sysctl. conf Linux kernel IP Forwarding enable file
After the file is introduced, we will start to modify and pull it.
1. First, the network file is used first. This file is your main network setting file! In this file, you need to modify the approximate Network Architecture (such as the gateway address, Gateway name, and primary network card)
Next is our ifcfg-eth1 and ifcfg-eth0. These two files are the IP address files of your network card!
Ifcfg-eth0 corresponds to your intranet IP address and gateway. The ifcfg-eth1 corresponds to your Internet IP address and gateway. After opening it in the VI Editor, The content displayed in it is as follows:
DEVICE = eth1
BOOTPROTO = static
IPADDR = 192.168.0.1
BROADCAST = 192.168.0.255
NETMASK = 255.255.255.0
NETWORK = 192.168.0.0
GATEWAY = 192.168.0.1
ONBOOT = yes
DEVICE = eth1 is your hardware DEVICE name
BOOTPROTO = static is your configuration method (PPPOE can also be added)
BROADCAST = 192.168.0.255 is your BROADCAST address.
IPADDR = 192.168.0.1 is your IP address
NETMASK = 255.255.255.255.0 is your subnet mask
NETWORK = 192.168.0.0 is the address of your entire NETWORK segment
GATEWAY = 192.168.0.1 is your GATEWAY
ONBOOT = yes indicates whether to enable the NIC (that is, to use this file. Enabled by default)
2. After modification, we need to modify the hosts file. In this file, you can change the name and domain of your machine (working group)
3. Modify the sysctl. conf file. This file is the IP address forwarding file of LINUX. Here we must use IP forwarding. It can be written as follows:
Net. ipv4.ip _ forward = 1
Net. ipv4.conf. default. rp_filter = 1
Kernel. sysrq = 0
4. The static-routes file is used. This file is your static route table file! This file must be added! The syntax is as follows:
Eth0 (device name) net (Network Address) 192.168.0.0 (subnet) netmask 255.255.255.0 (gateway address) gw 192.168.0.1
5. Modify the resolv file. This file is the address file of your DNS server. Syntax:
Nameserver (DNS server) 202.100.4.15 (IP server address of DNS)
6. After modification, we need to modify the rc. local file! After modification, You can PING your ISP. If it works, everything is okay.
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