1. Environment
[Email protected] ~]# lsb_release-a
LSB Version:: core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32: Printing-4.0-noarch
Distributor Id:centos
Description:centos release 5.10 (Final)
release:5.10
Codename:final
[Email protected] ~]# getconf long_bit
32
2. Configure Ip/dns and other information
External network:
# ifconfig Eth0 | grep "inet Addr"
inet addr:222.47.48.25 bcast:222.47.48.63 mask:255.255.255.192
Intranet:
# ifconfig Eth1 | grep "inet Addr"
inet addr:192.168.1.2 bcast:192.168.1.255 mask:255.255.255.0
Dns:
# cat/etc/resolv.conf
NameServer 222.47.62.142
NameServer 222.47.29.93
3. Turn on the kernel forwarding function
echo 1 >/proc/sys/net/ipv4/ip_forward//NIC will revert to 0 after reboot, so change the following parameter to "1"
# Cat/etc/sysctl.conf | grep Ip_forward
Net.ipv4.ip_forward = 0
4. Configure NAT
# iptables-t nat-a postrouting-s 192.168.1.0/255.255.255.0-o eth0-j SNAT--to-source 222.47.48.25
# iptables-d FORWARD 1
#/etc/init.d/iptables Save
#/etc/init.d/iptables Restart
This article is from the "Square Hill" blog, please be sure to keep this source http://63638790.blog.51cto.com/513514/1559409
Linux NAT configuration for Internet access