[CentOS] Addressing outgoing connections to a specific interface

John Doe jdmls at yahoo.com
Mon Nov 8 05:22:33 EST 2010


From: Dotan Cohen <dotancohen at gmail.com>

> This is on the Internet-connected  interface:
> wlan0     Link encap:Ethernet  HWaddr  00:18:de:98:c7:34
>           inet  addr:192.168.0.26  Bcast:192.168.0.255  Mask:255.255.255.0
>            inet6 addr: fe80::218:deff:fe98:c734/64  Scope:Link
>           UP BROADCAST RUNNING  MULTICAST  MTU:1500  Metric:1
>           RX  packets:114879 errors:0 dropped:0 overruns:0 frame:0
>            TX packets:78945 errors:0 dropped:0 overruns:0 carrier:0
>            collisions:0 txqueuelen:1000
>            RX bytes:104017653 (104.0 MB)  TX bytes:11292782 (11.2  MB)
> And this is on the LAN-connected interface:
> eth0       Link encap:Ethernet  HWaddr 00:15:c5:c8:13:d1
>            inet addr:192.168.0.101  Bcast:192.168.0.255   Mask:255.255.255.0
>           inet6 addr:  fe80::215:c5ff:fec8:13d1/64 Scope:Link
>           UP  BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>            RX packets:1921474 errors:0 dropped:0 overruns:0  frame:0
>           TX packets:8322288 errors:0  dropped:0 overruns:0 carrier:0
>            collisions:0 txqueuelen:1000
>           RX  bytes:146445850 (146.4 MB)  TX bytes:3479224403 (3.4 GB)
>            Interrupt:17

Not sure if it will work but worth the try...
If wlan0 is only for the internet (so no 192.168.x.y destinations), have a 
default gateway pointing to wlan0.
Then have the 192.168.0.0 point to eth0.
Something like:
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  192.168.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
  0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0

JD


      


More information about the CentOS mailing list