LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-27-2012, 02:53 PM   #1
TCB13
LQ Newbie
 
Registered: Jul 2012
Posts: 5

Rep: Reputation: Disabled
Angry IPTables/Route and multiple interfaces configuration


Hello!
I'm not a linux expert but I've this scenario, a Debian box running with multiple network cards:

1. eth0 - Internet Connection via local Router (172.20.1.x , 255.255.255.0)
2. ppp0 - Dial-up to a network without internet (10.x.x.x , 255.255.255.255)

My goal is to be able to surf the web on this machine and allow SSH and other services to be accessible from the two networks.
Right now, I'm able to reach the router on eth0 (172.20.1.1), but I can't get to google or anywhere else on the internet as you can see bellow... (And no, it's not a DNS issue. I tried the IP)

Quote:
root@iklive-shv1:~# ping 172.20.1.1
PING 172.20.1.1 (172.20.1.1) 56(84) bytes of data.
64 bytes from 172.20.1.1: icmp_req=1 ttl=64 time=0.416 ms
64 bytes from 172.20.1.1: icmp_req=2 ttl=64 time=0.428 ms
^C
--- 172.20.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.416/0.422/0.428/0.006 ms
root@iklive-shv1:~# ping google.com
PING google.com (173.194.34.197) 56(84) bytes of data.
^C
--- google.com ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3003ms

root@iklive-shv1:~# ping 173.194.34.197
PING 173.194.34.197 (173.194.34.197) 56(84) bytes of data.
^C
--- 173.194.34.197 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2004ms
My current routing table is:

Quote:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.64.64.64 0.0.0.0 UG 0 0 0 ppp0
10.64.64.64 * 255.255.255.255 UH 0 0 0 ppp0
172.20.1.0 * 255.255.255.0 U 0 0 0 eth0
172.50.1.0 172.50.1.2 255.255.255.0 UG 0 0 0 tun0
172.50.1.2 * 255.255.255.255 UH 0 0 0 tun0
I also tried to change the default gateway to the router IP (172.20.1.1) using:

Quote:
route add default gw 172.20.1.1 eth0
I can access the internet but then clients can't connect or ping my machine over the dial-up connection (ppp0).
How can I do it? I tried some custom ip route routes but I wasn't able to get it work.

Thank you!

Last edited by TCB13; 07-27-2012 at 11:15 PM.
 
Old 07-27-2012, 10:03 PM   #2
TCB13
LQ Newbie
 
Registered: Jul 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
After a long search e come across a solution but I'm not sure about some parameters...

Supposing that eth0 has the IP 172.20.1.7 and ppp0 has 10.184.225.42.

Quote:
echo 200 localnet >> /etc/iproute2/rt_tables
echo 201 dialup >> /etc/iproute2/rt_tables

ip route add <NET1> dev eth0 src <SRC1> table localnet
ip route add <NET2> dev ppp0 src <SRC2> table dialup

ip route add default via 172.20.1.7 table localnet
ip route add default via 10.184.225.42 table dialup

ip rule add from 172.20.1.7 table localnet
ip rule add from 10.184.225.42 table dialup
What shout be <NET*> and <SRC*> are the other parameters configured the right way?
I took that from http://unix.stackexchange.com/questi...s-two-gateways.

Thanks.

Last edited by TCB13; 07-27-2012 at 10:10 PM.
 
Old 07-28-2012, 11:27 AM   #3
TCB13
LQ Newbie
 
Registered: Jul 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
So... I managed to solve this issue by:

Quote:
route add default gw 172.20.1.1 eth0
route add -net 10.0.0.0 netmask 255.0.0.0 ppp0
This sets my default gateway on eth0 and it's router and adds a new route for the 10.x.x.x network.

This way I'm able to reach the internet and still be accessible over the ppp0 dial-up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
squid configuration, multiple eth interfaces zeeshan12 Linux - Networking 8 03-25-2008 12:26 PM
iptables configuration using multiple NIC karen.pertierra Linux - General 2 02-21-2007 03:09 AM
Iptables firewall in multiple lan interfaces Neelesh Linux - Security 3 07-31-2004 02:19 PM
IPTables and multiple interfaces MaverickApollo Linux - Networking 7 12-28-2003 05:19 PM
netfilter iptables and multiple interfaces raypen Linux - Networking 1 07-23-2002 10:07 PM


All times are GMT -5. The time now is 10:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration