LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-23-2014, 07:10 PM   #1
stevenm
LQ Newbie
 
Registered: Jan 2014
Posts: 2

Rep: Reputation: Disabled
Issues with routing and default gateways using multiple nics


First off, thanks for reading.
I have a ESXi CentOS 6 server with 3 nic cards running behind a pfSense.

en0= 10.0.0.242
en1= 192.168.1.242
en2= 172.16.0.242

en0 is ideally my gateway. It has a 1:1 mapping with an external IP and is on a virtual network for like traffic.

en1 is connected to my on-site physical infrastructure.

en2 is on a virtual network that has a site to site IPSec VPN.

Now, if en2 is my gateway then everything works except outbound traffic goes through a different IP then my 1:1 and screws all of my external links up. If en0 is my gateway then everything works properly outside but I cannot ping into or out of en2 from the VPN.

So the question I have is am I doing something wrong on my server or firewall? If you know which, do you happen to know why? Thanks.
 
Old 01-24-2014, 04:44 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Sounds like you just need to identify which specific routes need to go via the vpn. Add that as an additional route to your routing table, leaving the default gateway on en0.
 
Old 01-24-2014, 10:17 AM   #3
stevenm
LQ Newbie
 
Registered: Jan 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for such a fast response. Would that allow for incoming communication to start on that interface as well? It seems through my goggling that it only affects outbound routes.
 
Old 01-27-2014, 02:12 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
a server can't control how traffic gets to it, that (outside of dynamic routing protocols which aren't relevant here) makes no sense. That is the routing table. It controls where each individual packet goes. It is stateless, every packet leaving the box follows the rules there, no matter if it were part of an inbound of outbound established connection
 
Old 01-27-2014, 02:22 AM   #5
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
As a general rule, multiple default gateways never make sense. You're telling the IP stack "please load balance outbound traffic across these gateways", and there are precious few scenarios where this is the desirable behaviour.

What exactly do you mean by "if en2 is my gateway then everything works"? Surely the system can't be its own gateway, so I'm assuming you mean some other router on that network?

"Regular" routing (entries in the default routing table) is all about destination addresses, and as such, you can only route selected traffic to a gateway on the network connected to en2 if you know the destination addresses involved. However, if you want to route all connections involving the IP address 172.16.0.242 to a certain gateway, that is actually possible with policy routing. Is that what you're looking for?
 
  


Reply



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 to multiple gateways The Jesus Linux - Networking 6 09-20-2012 01:58 AM
iptables: marking packets for routing to two default gateways obaidmushtaq Linux - Networking 2 01-19-2010 09:01 AM
Multiple ips/gateways one NIC - Routing gsaminath Linux - Newbie 4 05-27-2009 02:28 AM
Routing with multiple gateways dimavo Linux - Networking 6 08-07-2007 02:09 AM
Routing issues with multiple nics on ClarkConnect 2.2 (RedHat 9) Killbot_5000 Linux - Networking 1 01-13-2005 10:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:36 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
Open Source Consulting | Domain Registration