Jump to content

debian networking services. device priority. eth0>wlan


i8igmac

Recommended Posts

my understanding.

If eth0 is up and working, then you launch wpa_supplicant -iwlan0

Eth0 gateway ->192.168.0.1

Wlan0 gateway->10.0.0.1

You will notice eth0 is still the active connection. route -n will show the gatway is still 192.168.0.... I can change this with ip route gw add via 10.0.0.1.

so, what service or config is responsible for device priority? eth0>wlan0

Link to comment
Share on other sites

i have looked into a few examples of metric, seems like it could be the right place...

so, ill start off by showing what my machine looks like with wlan2 down... im ssh into the machine by eth0

turdsplash@192.168.96.148# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.96.1    0.0.0.0         UG    0      0        0 eth0
192.168.96.0    0.0.0.0         255.255.255.0   U     1      0        0 eth0

all my machines can talk threw this gateway... here is a little trick to get your external ip address

turdsplash@192.168.96.148# curl http://ifconfig.me
71.212.63.195

Typically if you want to use a wireless card to connect to a access point and start surfing the internet, you would do something like this...

turdsplash@192.168.96.148# wpa_supplicant -Dnl80211 -iwlan2 -c/etc/wpa_supplicant.conf –B
Successfully initialized wpa_supplicant
wlan2: CTRL-EVENT-SCAN-STARTED 
wlan2: SME: Trying to authenticate with 14:ab:f0:11:d0:90 (SSID='HOME-D092' freq=2412 MHz)
wlan2: Trying to associate with 14:ab:f0:11:d0:90 (SSID='HOME-D092' freq=2412 MHz)
wlan2: Associated with 14:ab:f0:11:d0:90
wlan2: WPA: Key negotiation completed with 14:ab:f0:11:d0:90 [PTK=CCMP GTK=TKIP]
wlan2: CTRL-EVENT-CONNECTED - Connection to 14:ab:f0:11:d0:90 completed [id=0 id_str=]
turdsplash@192.168.96.148# dhclient wlan2
RTNETLINK answers: File exists

authentication worked and dhclient has issued me a new working ip address of 10.0.0.24

you can now ping all the machines on this newly accessible network...

turdsplash@192.168.96.148# ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=9.17 ms
^C
--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 9.172/9.172/9.172/0.000 ms

turdsplash@192.168.96.148# nmap -sP 10.0.0.*

Starting Nmap 6.40 ( http://nmap.org ) at 2016-03-06 20:06 PST
Nmap scan report for 10.0.0.1
Host is up (0.0023s latency).
MAC Address: 14:AB:F0:11:D0:91 (Arris Group)
Nmap scan report for 10.0.0.19
Host is up (0.11s latency).
MAC Address: 2C:41:38:3D:0B:54 (Hewlett-Packard Company)
Nmap scan report for 10.0.0.24
Host is up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 24.20 seconds

all is going as expected, until you try and ping google.com and you notice the packets are still passing threw the default gateway assigned to eth0...

this default gateway assigned to eth0 is the priority for many reasons, one might be quality or strength of this connection is better.

turdsplash@192.168.96.148# curl http://ifconfig.me
71.212.63.195

you can see above, that this machine is still using the same ISP (external ip address) (instead of the new one)

at this point here is a route -n showing eth0 is still holding the default gateway

turdsplash@192.168.96.148# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.96.1    0.0.0.0         UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 wlan2
192.168.96.0    0.0.0.0         255.255.255.0   U     1      0        0 eth0

so, to complete the connection you have to perform these next 2 steps (i hope to eliminate the ip route commands)

turdsplash@192.168.96.148# ip route delete default
turdsplash@192.168.96.148# ip route add default via 10.0.0.1
turdsplash@192.168.96.148# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 wlan2
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 wlan2
192.168.96.0    0.0.0.0         255.255.255.0   U     1      0        0 eth0
turdsplash@192.168.96.148# curl http://ifconfig.me
73.225.146.158


now things are working as it should... you can see the new isp address and the default gateway the traffic is passing threw...

i hope to simply run 2 commands to complete this interface (wpa_supplicant and followed by dhclient)

Mr-protocal made a suggestion of changing the metric values but i have not been successful...

maybe some example commands?

How to remove this eth0 priority :angry:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...