LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 10-08-2007, 04:16 PM   #1
GLxZ
LQ Newbie
 
Registered: Nov 2005
Location: Taurage, Lithuania
Distribution: gentoo, slackware
Posts: 3

Rep: Reputation: 0
Question routing problem


Hello everyone,

I've got some problems with routing. I have eth0 and eth1 in my linux box.

eth0 192.168.1.49, gateway 192.168.1.1, mask 255.255.255.0
eth1 172.17.130.253 gateway 172.17.130.254, mask 255.255.0.0

yes, each ethernet connection has a gateway address. The thing that I am trying to make is to make all the traffic from network 172.17.0.0/24 go through this box's eth1 to the gateway 172.17.130.254. I've already tried some tricks with routing table and iptables with no results. Note that I use 192.168.1.1 as a main gateway.

The reply with the solution to this problem would be appreciated.
 
Old 10-09-2007, 09:20 AM   #2
lordy
LQ Newbie
 
Registered: Feb 2003
Location: Bulgaria
Distribution: debian/fedora
Posts: 11

Rep: Reputation: 0
; create separate routing table
echo "lan" >> /etc/iproute2/rt_table

; fill 'lan' routing table
ip route add dev eth1 172.17.130.254 src 172.17.130.253 table lan
ip route add default via 172.17.130.254 table lan

; rule all traffic from desired network to route by 'lan' routing table
ip rule add from 172.17.0.0/24 table lan

i hope it helps
 
Old 10-09-2007, 03:38 PM   #3
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
If I understand this you have two networks attached to the eth1 nic
172.17.0.0/24 and 172.17.130.0/24
And eth0 is 192.168.1.0/24
Then you want traffic on 172.17.0.0/24 and 172.17.130.0/24 to through eth1 to eth0
I assume this traffic is mostly internet related.
Is this correct?

Brian
 
Old 10-10-2007, 07:17 AM   #4
GLxZ
LQ Newbie
 
Registered: Nov 2005
Location: Taurage, Lithuania
Distribution: gentoo, slackware
Posts: 3

Original Poster
Rep: Reputation: 0
Not really, Brian. There are two separate networks. 172.17.130.0/24 works perfectly without routing it through my box, since it has a router (172.17.130.254) and the link into the world. 192.168.1.0/24 is another network (the main internet connection of my box). Those two networks shouldn't work together I just want to do the packet filtering and network monitoring for 172.17.130.0/24 using my linux box. I don't want the traffic from 172.17.130.0/24 go through 192.168.1.1 router.
 
Old 10-10-2007, 07:21 PM   #5
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
I understand what you are doing now. Not sure of how to do it though. To me blocking eth1 traffic going out to eth0 seems to block actually access to eth1 network. Maybe something will popout to me.

Brian
 
Old 10-12-2007, 06:32 AM   #6
rmitev
LQ Newbie
 
Registered: Sep 2007
Posts: 27

Rep: Reputation: 15
see second post (lordy) ...

Your linux box must be a gateway for 172.17.0.0/24 network ...
set 172.17.130.254 at your pc and 172.17.130.253 at old gateway ...

ip ro add default via 172.17.130.253 table 100
ip rule add from 172.17.0.0/24 table 100

and !!!important!!! disable send_redirects and accept_redirects in kernel (/proc/sys/net/ipv4/conf/all)
 
Old 10-14-2007, 04:50 PM   #7
GLxZ
LQ Newbie
 
Registered: Nov 2005
Location: Taurage, Lithuania
Distribution: gentoo, slackware
Posts: 3

Original Poster
Rep: Reputation: 0
I forgot to mention that I can't change my router's IP. So rmitevs' solution doesn't work either. I have an idea how to make it using one more lan card, though. I'll let you know how will that go. Take care everyone.
 
Old 10-16-2007, 06:01 AM   #8
rmitev
LQ Newbie
 
Registered: Sep 2007
Posts: 27

Rep: Reputation: 15
with one more lan card you can do a transparent bridge and set it before gateway

[72.17.0.0/24 network] <-----> [eth1 - your PC - eth2] <-----> [gateway 172.17.130.254]
 
  


Reply

Tags
gateway, gentoo, iptables, networking, routing, second


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
Routing problem!! vishamr2000 Linux - General 0 05-21-2006 02:26 PM
routing problem durak Linux - Networking 1 11-14-2005 02:20 AM
Routing problem eqxro Linux - Networking 3 03-16-2005 07:27 PM
Routing Problem StraitFaced Linux - Enterprise 8 10-26-2004 11:22 AM
Routing problem, Please help! phildawson Linux - Networking 7 12-20-2003 07:11 PM


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

Main Menu
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