routing - Linux - Route Specific Traffic Through Ethernet -


at work have 2 networks; wifi 1 normal internet access, , internal lan one, repo etc. i've started using linux , it's pain having switch between cable , wifi. on windows, solved (so can connected both network simultaneously) running commands:

# add route traffic destination starting 10 (internal traffic): route add 10.0.0.0 mask 255.0.0.0 10.18.21.129 metric 40 -p # move default route higher metric: route change 0.0.0.0 mask 0.0.0.0 10.18.21.129 metric 40 

after running these , connecting wifi, worked magically. necessary linux commands achieve same result? i've fiddled around lot route command, haven't had luck. appreciate help.

edit: here output of route -n command before entering other commands:

kernel ip routing table destination     gateway         genmask         flags metric ref    use iface 0.0.0.0         10.18.21.129    0.0.0.0         ug    0      0        0 eth0 10.18.21.128    0.0.0.0         255.255.255.128 u     1      0        0 eth0 192.168.56.0    0.0.0.0         255.255.255.0   u     0      0        0 vboxnet0 192.168.88.0    0.0.0.0         255.255.252.0   u     9      0        0 wlan0 

variant 1: direct translation of solution linux one

route command:

  • route add -net 10.0.0.0/8 gw 10.18.21.125 metric 40
  • route del default
  • route add default gw 10.18.21.125 metric 40

ip route command:

  • ip route add 10.0.0.0/8 via 10.18.21.125 metric 40
  • ip route del default via 10.18.21.125
  • ip route add default via 10.18.21.125 metric 40

add launch of these command after wifi connected or startup script.

variant 2. turn magic off :)

  • turn route of 10.0.0.0 network via lan interface using command this: ip route add 10.0.0.0/8 via 10.18.21.125 metric 10. in case traffic routed via default interface, except 10.0.0.0/8 network.
  • increase priority default wifi route, if lower lan one

ps. possibly question should placed on server fault site :)

edit: according provided route map

  • route del default
  • route add default gw [wifi gateway ip]
  • route add -net 10.0.0.0/8 gw 10.18.21.125

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -