0

in my raspberry pi running debian os i have 2 interfaces, wlan0 & eth0. Both of interfaces got dhcp from both gateway server. How can i ping both LAN ? For example :

eth0 -> gateway 10.1.22.1 -> LAN 10.0.0.0/8
wlan0 -> gateway 192.168.10.1 -> LAN 192.168.10.0/24
                              -> also can browse internet

the route table that i get is :

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.1.22.1       0.0.0.0         UG    203    0        0 eth0
default         192.168.10.1    0.0.0.0         UG    304    0        0 wlan0
10.1.22.0       0.0.0.0         255.255.255.0   U     203    0        0 eth0
192.168.10.0    0.0.0.0         255.255.255.0   U     304    0        0 wlan0

I can ping LAN 10.0.0.0/8 but cannot browsing internet. How can i browse internet and also ping LAN 10.0.0.0/8 ?

Sorry, it's basic linux network configuration. I'm not familiar with linux os. May someone can help me to figure it out.

3 Answers 3

0

The default route is used for machines that aren't on your local network (i.e. it's for Internet access).

You have two default routes which is a bit confusing, because you're saying you have two different ways to access the Internet.

I am guessing one of these is wrong, and perhaps 10.1.22.1 is not acting as an Internet gateway, which is why you can't access the Internet.

I imagine the solution is to remove this route and only have one default route, with a gateway that provides you with Internet access.

If you still want to ping hosts on 10.0.0.0/8 but outside the LAN segment (10.1.22.0/24) then set the gateway destination to be 10.0.0.0/8 rather than default, so only traffic for the 10.0.0.0/8 network (and not Internet traffic) goes via that route.

0

You should remove the default route on the eth0 interface, or at least use a higher metric value than on the interface you want to use to reach the internet. You now have two competing default routes, and your RPi is choosing the wrong interface to route packets to non-local addresses.

There is also an inconsistency in your question: in the text you mention the LAN 10.0.0.0/8, but the routing table has netmask 255.255.255.0, i.e. 10.0.0.0/24.

0

I've finally complete the setup by adding more route in /lib/dhcpcd/dhcpcd-hooks and adding 40-route file which has contents

ip route add 10.0.0.0/8 via 10.1.22.1

and adding more lines in /etc/dhcpcd.conf

interface wlan0
metric 100

interface eth0
metric 200

Now i can ping both LAN. One more questions is, on gateway 192.168.10.1 actually has ip address 10.0.0.0/8 also.. So, how can we separate for example ip address starting from 10.0.0.1 up to 10.0.0.21 should came from gateway 10.1.22.1, and starting from 10.0.0.22 up to 10.254.254.254 will goes to gateway from 192.168.10.1 gateway 192.168.10.1 also has internet access. but 10.1.22.1 no internet (just used for voip server gateway).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .