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 -> LAN
wlan0 -> gateway -> LAN
                              -> also can browse internet

the route table that i get is :

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    203    0        0 eth0
default         UG    304    0        0 wlan0   U     203    0        0 eth0   U     304    0        0 wlan0

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

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


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 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 but outside the LAN segment ( then set the gateway destination to be rather than default, so only traffic for the network (and not Internet traffic) goes via that route.


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, but the routing table has netmask, i.e.


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 via

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 actually has ip address also.. So, how can we separate for example ip address starting from up to should came from gateway, and starting from up to will goes to gateway from gateway also has internet access. but 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 .