LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   switch between wired/wireless (https://www.linuxquestions.org/questions/linux-wireless-networking-41/switch-between-wired-wireless-489628/)

hsupoyang 10-05-2006 04:20 AM

switch between wired/wireless
 
Hi,all
I am a newbie here, glad that I found this place :)
I have a question that in case I have a device (say LAN IP 192.168.0.10) which is switching between wired and wireless network. The switching is good and getting the wireless IP from AP perfectly.
The question is, how come I can still ping/access the old wired IP after the device is using it's new IP from wireless AP? On the device, the ethernet interface changes from eth0 to rausb0, but if I do "ifconfig eth0 up", the IP of eth0 is still the old one! I think it should be "cleared" after network switching... Is that the problem of the network device driver cache was not refreshed?
thanks for any advices.

regards,
hsupoyang

kstan 10-05-2006 06:32 AM

I do "ifconfig eth0 up", the IP of eth0 is still the old one! I think it should be "cleared" after network switching... Is that the problem of the network device driver cache was not refreshed?
you shouldn't use ifup since the interface is up, it is true linux won't set your eth0 ip to 0.0.0.0 once you disconnect the network cable

If you feel not confortable with this simply make a script to bring down eth0 with 'ifdown eth0' during wireless on.

hsupoyang 10-05-2006 07:16 AM

Quote:

Originally Posted by kstan
I do "ifconfig eth0 up", the IP of eth0 is still the old one! I think it should be "cleared" after network switching... Is that the problem of the network device driver cache was not refreshed?
you shouldn't use ifup since the interface is up, it is true linux won't set your eth0 ip to 0.0.0.0 once you disconnect the network cable

If you feel not confortable with this simply make a script to bring down eth0 with 'ifdown eth0' during wireless on.

thanks kstan, :)
I use "ifconfig eth0 up" just want to see if the IP of the eth0 interface changes, but apparently not.
This happends when I try to switch network connection from LAN(e.g. 192.168.0.10) to WLAN (e.g. 19.168.0.x), the WLAN happens to use the same segment "0" (but not the same segment in fact), so I found that the old LAN IP still works and start to trace what happens.
So, does it because the eth0 device driver or kernel keep the old IP information and not to clean it?

hsupoyang

dracolich 10-05-2006 02:22 PM

If all you're doing is switching from one interface to another to access data then the previous interface hasn't changed. It won't change unless it's instructed to do so either by the os or by you.

Like kstan mentioned, when just checking the status of an interface simply use ifconfig eth0 or just ifconfig. There's no need to use up, but if you want to switch one off use down. i.e. ifconfig eth0 down.

Quote:

the WLAN happens to use the same segment "0" (but not the same segment in fact)
What do you mean by this? It looks as though their both on the same "segment". Do they also have the same netmask? i.e. 255.255.255.0 That could cause issues if they're both "up". If they're not the same "segment" or netmask then your wired/wireless access points should have appropriate addresses/netmasks as well.

kstan 10-05-2006 07:17 PM

in tcp/ip don't care how many interface you facc, as long as your interface is join into a network and the network have a dhcp server, then the interface will get an ip (unless you use static ip).

To check your interface status(have link or not), simply type 'sudo mii-tool' or 'mii-<tab><tab>' to see available option (depends distro).

Ks

hsupoyang 10-08-2006 09:42 PM

Quote:

Originally Posted by dracolich
If all you're doing is switching from one interface to another to access data then the previous interface hasn't changed. It won't change unless it's instructed to do so either by the os or by you.

Like kstan mentioned, when just checking the status of an interface simply use ifconfig eth0 or just ifconfig. There's no need to use up, but if you want to switch one off use down. i.e. ifconfig eth0 down.



What do you mean by this? It looks as though their both on the same "segment". Do they also have the same netmask? i.e. 255.255.255.0 That could cause issues if they're both "up". If they're not the same "segment" or netmask then your wired/wireless access points should have appropriate addresses/netmasks as well.

Thanks for your kindly answer,
The whole story is, I am tesing my device between wired and wireless environment. At first I am in the LAN environment which IP is 192.168.0.10, and then I set up the wireless access point and switch my device to using WLAN which getting its IP via DHCP on wireless AP, the result is 192.168.0.7 (it happens to have the same third digit in their IP address, but they are surely not the same segment and should not connect to each other).
And then I unplugged the LAN and type the old IP (192.168.0.10, I should type 192.168.0.7 but just typo, so the question arises...:P) to use the web interface of the device (in theory, the old LAN IP address should be not accessable after I switch to WLAN without problem, but amazingly, I can still access the web interface (or ping) via old LAN IP address...

I did know that to check the status of ethernet interface is just using "ifconfig" (and the result is ok, there are only interfaces "lo" and "rausb0" without "eth0"), but I just want to know why the old LAN IP address "remains" in the interface which was not used anymore and not been cleared once it was "down", that's the reason why I "ifconfig eth0 up" to see what happened in the eth0 interface.

Thanks for your kindly answers, now I know that's the responsibility of kernel or user to do so... ;)

dracolich 10-09-2006 03:31 PM

I should've asked this before, is the AP a wireless router like Netgear or D-Link that allows both connections? That would be why the addresses are working the way they are. The router uses just one address so it doesn't matter wether the host connects via wired or wireless. Tat's why when you get an address via DHCP the first three octets are the same as what you had when wired. It might be configurable in the router's setup and that might depend on the router.

hsupoyang 10-10-2006 09:38 PM

Quote:

Originally Posted by dracolich
I should've asked this before, is the AP a wireless router like Netgear or D-Link that allows both connections? That would be why the addresses are working the way they are. The router uses just one address so it doesn't matter wether the host connects via wired or wireless. Tat's why when you get an address via DHCP the first three octets are the same as what you had when wired. It might be configurable in the router's setup and that might depend on the router.

dear dracolich,
thanks for your post and yes, the AP is a wireless router but does not allow both connections. The addresses are working the way they are because I didn't do the "clear" previous IP address on the previous unused interface. The reason why the first three octets are the same is just by accident and hence my question pops up ;) but everything is ok so far, thanks all again. :)


All times are GMT -5. The time now is 05:07 PM.