1

I have Motion running on my Pi.

I want to be able to access the Motion interface/feed (hosted on <pi ip>:8081) to be accessible both via WiFi and via Ethernet with a static address and DHCP for both the interfaces. I would also prefer to keep them isolated from each other/not have them bridged.

Have configured wlan0 to act as a wireless access point (as give in this guide, but without the Routing/Masquerade).

This worked as expected.

After this I tried doing the same for Ethernet, so I also added a static address for eth0 to /etc/dhcpcd.conf and added entry to enable dnsmasq for eth0 (via a file in etc/dnsmasq.d/).

The static address for eth0 is different from wlan0 and so are the dhcp-range.

I can only access via one of the interfaces at a time. So if I boot up the Pi connected with the Ethernet, I can access Motion on the Pi (via Ethernet). However, access via WLAN fails. On the other hand, with Ethernet unplugged I can access Motion via WLAN.


How do I enable both the Eth and Wlan to work independently with DHCP and static IP on both of them to access Motion on the Pi?

Also, is it possible to have the same static IP address for both the interfaces?


Edit: Output of various commands as asked by @eftshift0:

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether b8:27:eb:c3:d7:6b brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether b8:27:eb:96:82:3e brd ff:ff:ff:ff:ff:ff


$ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:c3:d7:6b brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::f98e:1b2a:d923:6474/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:96:82:3e brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.2/24 brd 192.168.0.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::496:128:e7ec:f5b0/64 scope link 
       valid_lft forever preferred_lft forever


$ netstat -lntp | grep 8081
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      -       
Kanchu
  • 115
  • 5
  • 1
    Do you want DHCP or static IP? I still don't understand WHY so many Pi users want static IP - other computer users get by without – Milliways Jul 30 '18 at 16:36
  • @Milliways, static IP is to make the Motion interface easily accessible - any user just has to point to a fixed IP without needing to figure out IP addresses. – Kanchu Jul 30 '18 at 16:45
  • What is the output of these commands when you have both interfaces up? ip link show ip addr show ip route show. Then what do you see when you run this? netstat -lntp | grep 8081. You can add the output to your question. – eftshift0 Jul 30 '18 at 17:17
  • 1
    Let me answer one of your questions, at least: Also, is it possible to have the same static IP address for both the interfaces?. The answer is no. Different interfaces need to be set up to different network segments (let alone, IP addresses), unless you know what you are doing. – eftshift0 Jul 30 '18 at 17:19
  • 1
    You want your RPI to act as DHCP server, one for eth0, one for wlan0, right? Is there another DHCP server on one of the subnets, maybe from an internet router? Is there anywhere a connection to the internet? You wrote "The static address for eth0 is different from wlan0 and so are the dhcp-range". Just now that isn't true as ip addr show. Both interfaces are on the same subnet 192.168.0.0/24. – Ingo Jul 30 '18 at 19:00
  • OK... Will try on different segments/subnets... – Kanchu Jul 31 '18 at 09:07

1 Answers1

1

The problem that you are having is that Linux does not like having multiple interfaces on the same subnet. (Another question regarding this.) In its routing table, it will choose one of the interfaces as the "best" route to your local network, so all the other interfaces will end up not seeing any traffic. It is possible to get this configuration to work, but you'll need to set up ARP rules and policy-based routing tables.

I do have to wonder if you need this complicated of a setup though: without bridging, traffic from the two interfaces would never see each other anyways. If you're using the wireless interface as an AP that is completely separated from the wired network, it shouldn't be using the same network address (give it something like 192.168.1.1/24.) That would take care of the issue.

ErikF
  • 166
  • 2