bobdxcool
Posts: 84
Joined: Sun Apr 14, 2013 12:41 pm

using wifi and Ethernet at the same time for network camera

Tue Oct 27, 2015 4:19 pm

I have a dlink network camera connected to my pi using a LAN cable. On the other hand, I also have a USB wiif module connected to my pi, which will be connected wirelessly to my access point in my home. Now, the problem is when wifi is active, I am not able to use my camera, and when the camera is active I cannot use wifi. Is there any way of making this work simultaneously , so that I can have the pi access the camera over ethernet and at the same time be connected to the internet using wifi ?

The static IP I have assigned to my camera is 192.168.1.20, and the static IP I have assigned to my system eth0 is 192.168.1.190 .One more thing is that when my wifi module is connected to the access point, wlan2 IP address shows up as 192.168.1.xx.

Is this same subnet the reason why both wifi and ethernet cannot be used at the same time ?

My /etc/network/interfaces file

Code: Select all

iface eth0 inet static
   address 192.168.1.190
   network 192.168.1.1
   broadcast 192.168.1.255
   gateway 192.168.1.1

auto wlan2
iface wlan2 inet dhcp

      wpa-ssid xxx
      wpa-psk 11122222
After booting up, my ifconfig output

Code: Select all

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:145 errors:0 dropped:0 overruns:0 frame:0
          TX packets:145 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:12634 (12.6 KB)  TX bytes:12634 (12.6 KB)

wlan2     Link encap:Ethernet  HWaddr c4:e9:84:0c:ad:95
          inet addr:192.168.1.106  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c6e9:84ff:fe0c:ad95/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:201 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2398 (2.3 KB)  TX bytes:19785 (19.7 KB)
For some reason eth0 doesnt show up, then I enter

ifconfig eth0 up
ifconfig eth0 192.168.1.190

Now, ifconfig shows :

Code: Select all

eth0      Link encap:Ethernet  HWaddr 00:0a:35:00:01:22
          inet addr:192.168.1.190  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20a:35ff:fe00:122/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:4495 (4.4 KB)
          Interrupt:54 Base address:0xb000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21598 (21.5 KB)  TX bytes:21598 (21.5 KB)

wlan2     Link encap:Ethernet  HWaddr c4:e9:84:0c:ad:95
          inet addr:192.168.1.106  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c6e9:84ff:fe0c:ad95/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23 errors:0 dropped:0 overruns:0 frame:0
          TX packets:296 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2440 (2.4 KB)  TX bytes:25675 (25.6 KB)
route command output

Code: Select all

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         WirelessAP      0.0.0.0         UG    100    0        0 wlan2
link-local      *               255.255.0.0     U     1000   0        0 wlan2
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan2
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: using wifi and Ethernet at the same time for network cam

Tue Oct 27, 2015 4:54 pm

bobdxcool wrote:Is this same subnet the reason why both wifi and ethernet cannot be used at the same time ?
I bet there are a lot of ways to do this but if you just plug two interfaces in, that is going to create the question of which to use when. Right now, if I understand you, only the pi can see the network, through the wifi, and the camera through the hard line. You want your wider network of machines, where you are at, say, to see all this. So you want to make sure that the pi continues to use the wifi for everything except for the camera, but it's not doing that out of the box. This might mean removing software that might autoconfigure things in a daffy manner. Then you can configure which interface does what. Whether there's a way to use the autoconfiguring software to make it justWork, I don't know.

paulv
Posts: 563
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: using wifi and Ethernet at the same time for network cam

Tue Oct 27, 2015 7:12 pm

Bob, it looks you are not on Jessie yet, and maybe you don't want to.
However, if you're willing to take the plunge, there may be a solution for you. I also struggled every now and then to get both eth and wlan working at the same time, but with Jessie it works without a hitch.

At the bottom of the first page of this post, I show a possible solution to your problem. viewtopic.php?f=63&t=110606&hilit=2+ip+addresses

Maybe you want to try this with a fresh SD card, or make a backup before you upgrade.

good luck.

User avatar
DougieLawson
Posts: 38788
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: using wifi and Ethernet at the same time for network cam

Tue Oct 27, 2015 7:31 pm

If you're on Wheezy use sudo apt-get purge ifplugd to get rid of that useless program that messes with your interfaces and won't allow the WiFi to run if the ethernet is connected.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Automation, sensing and robotics”