Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to route packets from an owner(lets say with uid-owner 'mailuser') to ppp1 network interface, and all other packets to ppp0 network interface. (Assuming the two network interfaces namely ppp0 and ppp1 are up)

So, I used the below-mentioned commands to test the proper routing of packets(which were generated by web browser with uid-owner 'mailuser'), to ppp1 network interface.

Following are the commands used (along with a short description) :

1. Copied all routes from table main to table 100 and table 200.

sudo ip route show table main
sudo ip route add <route1> table 100
sudo ip route add <route2> table 100
sudo ip route add <routeN> table 100

sudo ip route add <route1> table 200
sudo ip route add <route2> table 200
sudo ip route add <routeN> table 200

2. Changed the default routes for the tables 100 & 200.

sudo iptables route change default via <gateway_ip_of_ppp0> dev ppp0 table 100
sudo iptables route change default via <gateway_ip_of_ppp1> dev ppp1 table 200

3. Removed the routes in main table.

sudo ip route flush table main

4. Marked the packets if the uid is 'mailuser'.

sudo iptables -t mangle -A OUTPUT -m owner --uid-owner mailuser -j MARK --set-mark 0x1

5. Added rule to look up table 100 (default route through ppp0) for packets which are not marked.

sudo ip rule add not fwmark 0x1 lookup 100

6. Added rule to look up table 200 (default route through ppp1) for packets which are marked with 0x1.

sudo ip rule add fwmark 0x1 lookup 200

7. Flushed the routes in cache

sudo ip route flush cache

I expected all the traffic from user mailuser to be sent via ppp1, which was so, as seen over tcpdump -I ppp1. But, no response packets were received as inferred by the logs, hence, the browser(whose process has pid-owner mailuser) was not able to load any web-site.

So, What could be the problem here? As the browser is unable to load any web page when default route of table 200 is ppp1, whereas when I changed the default route to ppp0, it was working fine.

I have already checked ping command on both interfaces i.e. Ppp0 and ppp1, which works fine for both.

Please help in identifying & solving the problem of Why sending packets via the other 'ppp1' network interface fails?

share|improve this question

migrated from Aug 25 '11 at 9:32

This question came from our site for computer enthusiasts and power users.

If you've found an answer for this, go ahead and submit it as an answer and then accept it so that future people can know the answer as well. – Aaron Sep 29 '11 at 18:08

Are you sure that packets that leaves ppp1 have the correct source? Can you post a tcpdump output for ping command and for browser try to connect? Do you see a difference? If you have no answer for the packet that leaving ppp1, I may only assume that has the wrong source.

share|improve this answer
thanks for your response. the ping works fine, but browser connection fails, the problem was with the source address on packet, got it resolved – Animesh Sinha Aug 29 '11 at 5:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.