Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] 2 NICs & 2 IPs: how to route?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
yahont
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2004
Posts: 119
Location: SPb

PostPosted: Tue Sep 08, 2009 7:42 am    Post subject: [SOLVED] 2 NICs & 2 IPs: how to route? Reply with quote

Hi all!
I have a server with 2 NICs connecting to the Net through two different providers. I'd like to have an access to the server through both NICs, but I haven't managed so far to set both of them up. I keep one of them down, cause I've no idea how to set up the routing scheme. All I want to have is the server sending its replies through the NIC where it got the request from, and - of course - via correspondent router. I don't (not yet, at least) even want to balance the traffic initiated by server itself.
Is there a simple way to set up such routing table with /etc/conf.d/net? Or should I mess up with some weird iptables' policies? Could you help me please?
Thank you in advance!
_________________
This report, by its very length, defends itself against the risk of being read.
Winston Churchill


Last edited by yahont on Tue Sep 08, 2009 9:47 am; edited 1 time in total
Back to top
View user's profile Send private message
anello
Guru
Guru


Joined: 17 Jul 2005
Posts: 557
Location: EU -> DE -> Stuttgart

PostPosted: Tue Sep 08, 2009 7:56 am    Post subject: Reply with quote

You can do this with iproute2.

Search for "iproute2 multiple uplink howto" or similar ...
_________________
Antonino Catinello | http://catinello.eu
Back to top
View user's profile Send private message
yahont
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2004
Posts: 119
Location: SPb

PostPosted: Tue Sep 08, 2009 9:45 am    Post subject: Reply with quote

Thank you for keywords, anello! I found quite useful page with them http://www.gentoo-wiki.info/TIP_Dual-Homed_Gentoo_Server.
I did everythin as described, and put
Code:
ip rule add from <secondary ip> table dns

into "postup()" function in /etc/conf.g/net.
Code:
postup() {
   if [[ "${IFACE}" -eq "eth1" ]]; then
      ip rule add from <IP for eth1> table eth1tab
   fi
}

The second NIC is up now. And both IPs are responding from outside.
_________________
This report, by its very length, defends itself against the risk of being read.
Winston Churchill
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum