Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
ip route add 192.168.1.0/24 dev eth1 src 192.168.1.2 table 1
ip route add default via 192.168.1.1 table 1
ip rule add from 192.168.1.2 table 1
ip route add 192.168.2.0/24 dev eth2 src 192.168.2.2 table 2
ip route add default via 192.168.2.1 table 2
ip rule add from 192.168.2.2 table 2
ip route replace default scope global nexthop via 192.168.1.1 dev eth1 weight 1 nexthop via 192.168.2.1 dev eth2 weight 1
iptables -t mangle -N WAN0
iptables -t mangle -N WAN1
iptables -t mangle -N RESTORE
iptables -t mangle -A RESTORE -j CONNMARK --restore-mark
iptables -t mangle -A WAN0 -j MARK --set-mark 1
iptables -t mangle -A WAN0 -j CONNMARK --save-mark
iptables -t mangle -A WAN1 -j MARK --set-mark 2
iptables -t mangle -A WAN1 -j CONNMARK --save-mark
iptables -t mangle -A PREROUTING -i eth0 -p tcp -m state --state ESTABLISHED,RELATED -j RESTORE
iptables -t mangle -A PREROUTING -p tcp -m state --state NEW -m statistic --mode nth --every 2 --packet 0 -j WAN0
iptables -t mangle -A PREROUTING -p tcp -m state --state NEW -m statistic --mode nth --every 2 --packet 1 -j WAN1
iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
When doing traceroutes the traffic is leaving one of the two WAN links. Normal browsing works fine but downloads are extremely slow or time out after a while. Using the ADSL's normally from a system works fine.
Routing specific subnet (source ip) to a particular interface should be like this.
"ip rule add from 220.127.116.11/24 table 1"
"ip route add 18.104.22.168/24 table 1 dev eth4"
All traffic from 22.214.171.124/24 will be routed using routing table 1 through eth4.