Server Administration & Management

How to connect eth0 to ppp0 in linux

How to connect eth0 to ppp0 in linux              “OR”

How to Setup Linux as router for ppp dial up (PSTN/ISDN) connections

Step –> 1 Turn on ip forwarding in kernel

# vi /etc/sysctl.conf

Step –> 2 Add/modify following line

net.ipv4.ip_forward = 1

Step –> 3 Restart network

# /etc/init.d/network restart

(Note first dial to ISP using wvdial or similar program )

Step –> 4 Setup IP forwarding and Masquerading (to act as router), you need to use NAT option of iptables as follows:

# iptables –table nat –append POSTROUTING –out-interface ppp0 -j MASQUERADE

# iptables –append FORWARD –in-interface eth0 -j ACCEPT

# /etc/init.d/iptables save

# chkconfig iptables on

Step –> 5 You are done! Test it with ping or dig:

# ping google.com
# dig google.com

Step –> 6 Point all client to your eth0 IP address as Router/Gateway.

June 23, 2011 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment