+-------------+ +-------------+ +-------------+
----| | | | 10.0.0.* | |
BSNL| Modem | 192.168.1.* | Gateway |---------------| Internal M/C|
Cable| |---------------| (CentOS) |eth1 | (Ubuntu) |
| | (ppp) eth0| | | |
+-------------+ +-------------+ +-------------+
Step 1:
[root ]# echo 1 > /proc/sys/net/ipv4/ip_forward
Step 2:
[root ]# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
Step 3:
[root ]# echo 1 > /proc/sys/net/ipv4/ip_dynaddr
Step 4:
[root ]# /sbin/iptables -A FORWARD -i eth1 -o ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT
Step 5:
[root ]# /sbin/iptables -A FORWARD -i ppp0 -o eth1 -j ACCEPT
Step 6:
[root ]# /sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
Step 7:
[root ]# service iptables save
Step 8:
[root ]# service iptables restart
Step 9:
If you have some firewalls (like Redhat Firewall) enabled in your system, you must make the LAN interface trusted in the gateway machine.
And there you go. Step 4-9 can also be done using UI: /usr/bin/system-config-securitylevel-tui like this:
P.S.: Chennai LUG helped me for this.
No comments:
Post a Comment