cpighin
Posts: 43
Joined: Tue Mar 17, 2015 12:14 pm
Location: Ciampino (Rome), Italy

Network connection by cable and Wi-fi adapeter with TP-Link

Tue Mar 24, 2015 9:06 am

Network connection by cable and Wi-fi adapeter with TP-Link TL-WN725N V2

I learned how to connect the PC to my RPI2 ethernet wired and now I would like to do it via wi-fi.

Currently the ethernet connection is done using the package tightvncserver on RPI2 and xtightvncviewer on pc.

To enter always the same IP address on the PC when prompted, I set a static address for RPI2 and the file etc/networks/interfaces has the following content:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet static
address 192.168.0.9
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "......"
wpa-psk "......"
To connect wi-fi with RPI2, I bought an adapter TP-Link TL-WN725N that was not recognized automatically. To let RPI2 recognize the adapter I used the script posted by MrEngman (thanks :) ) and now I see the green LED flashing when I try to connect, even if Raspbian informs that:

Code: Select all

claudio @ ASUS-K53SJ: ~ $ xtightvncviewer
xtightvncviewer: ConnectToTcpAddr: connect: No route to host
Unable to connect to VNC server
I guess the problem comes from having set a static IP address for the Ethernet connection and not having done the same for the wi-fi.

If so, what should I do?

If not, what should I do?

Claudio :)

cpighin
Posts: 43
Joined: Tue Mar 17, 2015 12:14 pm
Location: Ciampino (Rome), Italy

Re: Network connection by cable and Wi-fi adapeter with TP-L

Tue Mar 24, 2015 4:05 pm

:) Waiting for your kind helps, I stepped forward.

Now I can access my RPI2 also via Wi-fi, but only under following conditions:

a) the Ethernet connections and the Wifi one only work separately, with prevalence to the Ethernet (of course this is my experiebce with current settings);
b) to start Wi-fi it is necessary:
- that che Etherner cable is plugged off,
- that the adapter is inserted after booting Raspbian (not before),
- to run the command "ifconfig" to get its IP address,
- to run "xtightvncviewer" on the PC,
- to run the authentication procedure to display on the PC the RPI2 Desktop .

Current settings are as follow:

File etc/network/interfaces:

Code: Select all

auto lo
iface lo inet loopback
 
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
 
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
File /etc/wpa_supplicant/wpa_supplicant.conf:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
 
network={
ssid="xxxxxx"
psk="xxxxxx"
}
Comments?

Claudio :)

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

Re: Network connection by cable and Wi-fi adapeter with TP-L

Tue Mar 24, 2015 4:41 pm

sudo apt-get purge ifplugd

Get rid of that useless thing and you can have both eth0 and wlan0 active.
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.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Network connection by cable and Wi-fi adapeter with TP-L

Tue Mar 24, 2015 4:42 pm

a) the Ethernet connections and the Wifi one only work separately, with prevalence to the Ethernet (of course this is my experiebce with current settings);
That's what the program 'ifplugd' does...
If you want to change the behaviour you can either change the settings or remove the program completely ('sudo apt-get purge ifplugd')

cpighin
Posts: 43
Joined: Tue Mar 17, 2015 12:14 pm
Location: Ciampino (Rome), Italy

Re: Network connection by cable and Wi-fi adapeter with TP-L

Tue Mar 24, 2015 8:09 pm

:) Thanks for your helps.

I purged 'ifplugd' and now I can use both modality of connection.

Now the next step is to try to manage my RPI2 bu my PC, either with an ethernet connection or with mt Wifi adapter, avoiding any monitor plugged on it.

How can I achieve that? Maybe by assigning a static address to the two modes?

What changes should I introduce in the configuration files?

Claudio :)

cpighin
Posts: 43
Joined: Tue Mar 17, 2015 12:14 pm
Location: Ciampino (Rome), Italy

Re: Network connection by cable and Wi-fi adapeter with TP-L

Wed Mar 25, 2015 10:24 am

I have been successful :D

Following the guide "Raspberry Pi – Configurare wifi e connessione automatica alle reti" http://www.hackerstribe.com/2015/raspbe ... alle-reti/ I modified the interfaces file, according to the text proposed and now I can manage my RPI2 via wi-fi with a static address, with the only change of such address: 192.168.0.12 instead of 192.168.1.111.

Now my interfaces file is as follows

Code: Select all

auto lo

iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
 
auto wlan0
iface wlan0 inet static
address 192.168.0.12
gateway 192.168.0.1
netmask 255.255.255.0

auto eth0
iface eth0 inet static
address 192.168.0.12
gateway 192.168.0.1
netmask 255.255.255.0
According to you, there are drawbacks in using 192.168.0.12 as static address?

Claudio :)

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

Re: Network connection by cable and Wi-fi adapeter with TP-L

Wed Mar 25, 2015 10:34 am

The range of address you can use as static depends on what's configured in the DHCP pool in your router.
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 “Troubleshooting”