I am using RPI3 with raspbian and I have it connected to my personnal network via wifi (works fine) but I also connected it to company network with cable. Also I am new to RPi and Linux.

So I have two interfaces active wlan0 and eth0. I dont use DHCP for neither. Problem is that I am able to ping just some of my company devices, not all of them so I think the problem is with routers so I tried to setup my RPI as any other PC inside company network.

My eth0 should be:
IP: 172.23.125.128
Mask: 255.255.255.0
Gateway: 172.23.125.250

but when I run route -n I get this:

0.0.0.0         192.168.1.1     0.0.0.0         UG    200    0        0 wlan0
0.0.0.0         172.23.125.250  0.0.0.0         UG    300    0        0 eth0
172.23.0.0      0.0.0.0         255.255.0.0     U     300    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     200    0        0 wlan0

As I said wlan0 is fine, metric works fine but I dont know why there is 172.23.0.0 and mask 255.255.0.0

I tried route add {ip} via {gw} without any change. I also tried to change my dhcpcd.conf file which now looks like this:

interface wlan0
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
static domain_search=192.168.1.1
static ip_address=192.168.1.112
noipv6
metric 200

interface eth0
noipv6
metric 300
static ip_address=172.23.125.128/24
static routers=172.23.125.250
static domain_name_servers=
static domain_search=

But there is no way to setup netmask. So how should I do that?

EDIT

ip route result default via 192.168.1.1 dev wlan0 src 192.168.1.112 metric 200 default via 172.23.125.250 dev eth0 src 172.23.125.128 metric 300 172.23.0.0/16 dev eth0 proto kernel scope link src 172.23.125.128 metric 300 192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.112 metric 200

I cant ping 172.21.205.96 but I can ping 172.23.126.212

  • 2
    The /24 sets the netmask to 24 bits 255.255.255.0 – Dougie Dec 5 at 7:40
  • also, not all computers respond to ping – Jaromanda X Dec 5 at 7:44
  • @Jaromanda X that is true but I am trying to ping Plcs and they all responde to ping – Somachr Dec 5 at 7:49
  • You can see that I already have set /24 – Somachr Dec 5 at 7:51
  • give an example of a non responsive ping IP address ... does it start with 172.23.125 ? – Jaromanda X Dec 5 at 7:51
up vote 2 down vote accepted

Your company uses the private ip address range 172.16.0.0 with a 12 bit address mask, in particular:

address block: 172.16.0.0 – 172.31.255.255 (1.048.576 addresses)
network:       172.16.0.0/12 or
               172.16.0.0    netmask 255.240.0.0

Writing 172.16.0.0./12 or 172.16.0.0 netmask 255.240.0.0 is equivalent. This private network block can be split into subnets for example that one that is set on your RasPi:

address block: 172.23.0.0 – 172.23.255.255 (65.536 addresses)
network:       172.23.0.0/16 or
               172.23.0.0    netmask 255.255.0.0

Now you can see that the ip address 172.23.126.212 is part of this block but not the address 172.21.205.96. You can only ping the former. You have to increase the subnet. If you use the hole private network 172.16.0.0/12 then you are on the save side. I don't know if this may have some side effects on your companies network. It could be split into other subnets with router so your RasPi may be confused. To get an idea about this you can look at the network settings of the host with ip address 172.23.126.212 and with 172.21.205.96.

Another issue is that you set a static ip address on the RasPi for the companies network. I don't believe that your company manages its network with static ip addresses but with DHCP. So simply setting a static ip address may conflict with another host which has get the same ip address by DHCP. This will not only break the RasPis communication but also your colleagues one.

I just can't see why you do not can set another netmask. It may be that other conditions on your setup doesn't make sense to set a lower netmask so it is simply suppressed. I suggest to clean up first your subnetting and then look again at this issue.

You also try to use the companies gateway (for internet access?) by setting it to 172.23.125.250. But as shown its default route has a higher metric (300) than the default route to your wlan router with ip address 192.168.1.1 and metric 200 so the last one will be used first if available. Is this what you want? If not you should avoid setting two gateways (default routes).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.