[TriLUG] sourcing outbound traffic from internal NIC
Tom Barron
tbarron at dyncloud.net
Sun Dec 6 15:52:48 EST 2009
Well, instead of driving this off a timer, you can run a script when the
interface comes up. Where you put the script depends on your OS flavor.
On Debian/Ubuntu systems, you could add a little script to
the /etc/network/if-up.d/ directory. On RedHat/Centos, check
out /etc/sysconfig/network-scripts/,
probably /etc/sysconfig/network-scripts/ifup-routes. Slackware, gentoo,
etc. have other hooks.
On Sun, 2009-12-06 at 14:34 -0500, Clay Stuckey wrote:
> I found part of the solution. Ip route default via [gw ip] src [int
> ip]. I have to remove the default gw first. This handles the issue at
> layer 3. My only issue is now to find the right way to make it persist
> a network restart. At the moment, I have a cron job that checks for a
> gw and will execute the ip route command if needed.
>
> --
> Clay Stuckey
> (919) 600-0486
> claystuckey at gmail.com
>
> On Dec 6, 2009, at 2:27 PM, Aaron Joyner <aaron at joyner.ws> wrote:
>
> > What IP traffic is sourced from can be determined by the application
> > (based on what IP it binds to, or what IP it received traffic on), so
> > you can't necessarily do this at the OS layer. You can't do it w/ a
> > route, as that will only control where the traffic is routed (ie. what
> > interfaces it traverses, and ultimately where it leaves the box), not
> > what the source IP of the traffic is in the IP header. You can make
> > it appear to remote hosts like all traffic has come from that IP, sort
> > of, by SNAT'ing traffic from the "internal" IP, but that may not be
> > what you actually want. Can you provide some more details about what
> > original goal led you down this technical path? If so, someone can
> > likely provide a good suggestion to accomplish what you're after.
> >
> > Aaron S. Joyner
> >
> >
> > On Sun, Dec 6, 2009 at 11:02 AM, Clay Stuckey
> > <claystuckey at gmail.com> wrote:
> >> I have a machine with 2 NICs. One is internet facing, the other
> >> internal.
> >> Anyone know of a way to have all internet-bound traffic sourced
> >> from the
> >> internal NIC's IP? I am thinking entering a default route rule that
> >> will
> >> specify to use the internal NIC. Has anyone tried this before?
> >>
> >> Clay
> >>
> >> --
> >> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> >> TriLUG FAQ : http://www.trilug.org/wiki/Frequently_Asked_Questions
> >>
> > --
> > TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> > TriLUG FAQ : http://www.trilug.org/wiki/Frequently_Asked_Questions
> --
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ : http://www.trilug.org/wiki/Frequently_Asked_Questions
--
Tom Barron
tbarron at dyncloud.net
+1 919-619-7572
More information about the TriLUG
mailing list