how to switch wlan0 to ue0

I know that delete my wifis in wpa_supplicant.conf and
service netif restart is able to do such thing, but I don't like it. Is there another way?
I tried
ifconfig wlan0 down
dhclient ue0
ifconfig ue0 up

but there's still no network.
1000042089.jpg
1000042088.jpg
1000042087.jpg
 
I know that delete my wifis in wpa_supplicant.conf and
You don't need to touch /etc/wpa_supplicant.conf.

This is a route(8) issue. When wlan0 is created, up and connected to the wifi access point, the default gateway is set to the wifi access point (here 192.168.43.1), e.g.:
Rich (BB code):
% ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=0
    ether ...
    inet 192.168.43.147 netmask 0xffffff00 broadcast 192.168.43.255
    groups: wlan
    ...

% netstat -rn4
Routing tables

Internet:
Destination        Gateway            Flags         Netif Expire
default            192.168.43.1       UGS           wlan0
127.0.0.1          link#2             UH              lo0
192.168.43.0/24    link#6             U             wlan0
192.168.43.147     link#2             UHS             lo0

By your method, ue0 gets an IP from the ue0 connected DHCP server but the default gateway will stay on the wifi router (check with netstat -rn4).

The easiest way to route ue0 to the correct gateway is to destroying wlan0 and then requesting an IP lease for ue0:
Rich (BB code):
!! METHOD 1: The ue0 interface is not created yet

# service netif stop wlan0
Stopping wpa_supplicant.
Waiting for PIDS: 13402.
Stopping Network: wlan0.
...
Destroyed wlan(4) interfaces: wlan0.

!! If this is a phone, activate USB tethering on the phone, the rest is configured automatically


!! METHOD 2: the ue0 interface is already created

# service netif stop wlan0

# dhclient ue0
DHCPREQUEST on ue0 to 255.255.255.255 port 67
DHCPACK from 192.168.42.129
bound to 192.168.42.64 -- renewal in 1800 seconds.

# netstat -rn4
Routing tables

Internet:
Destination        Gateway            Flags         Netif Expire
default            192.168.42.129     UGS             ue0
127.0.0.1          link#2             UH              lo0
192.168.42.0/24    link#5             U               ue0
192.168.42.64      link#2             UHS             lo0
The defautl gateway has changed from the wifi gateway 192.168.43.1 to the ue0 gateway 192.168.42.129


To reverse from ue0 to wlan0:
Rich (BB code):
# service netif stop ue0

# service netif start wlan0

!! check default gateway

# netstat -rn4
To control with service(8) the network interfaces, the interfaces must have a ifconfig(8) entry in /etc/rc.conf.
 
Back
Top