Re: switching from one network interface to another without reboot

2009-08-20 Thread Adam Vande More
On Thu, Aug 20, 2009 at 6:25 AM, Michal m...@infosec.pl wrote:

 Hello,

 How can I switch from one network interface to another without rebooting my
 system (7.2R)?

 Problem description: I've got a laptop with two network interfaces (wired
 em0 and wireless ath0). Every now and then I have to set up a DSL wireless
 box which comes with default settings so that I have to start with
 connecting my laptop via em0.
 em0 gets IP address from wireless box by DHCP. I log in to web interface
 and set everything up including WLAN and restart wireless box. At this point
 I would like to switch to ath0 and start using internet connection via
 wireless box.
 I'm taking em0 interface down with ifconfig em0 down and unplug the
 cable.
 I'm changing /etc/rc.conf entries to:
 ifconfig_em0=NOAUTO
 ifconfig_ath0=WPA DHCP
 Then I'm doing /etc/rc.d/netif restart and ath0 gets IP address via DHCP
 and is connected to wireless box (/etc/wpa_supplicant.conf is set up).

 But whenever I try to ping anything (including wireless box) I get
 interface down message because my system still tries to use em0.
 What else should I do to tell it that I'm connected to network via ath0
 now?

 Any suggestions are welcome.
 Michal
 --
 The quiter you become, the more you can hear. -Ram Dass


 /etc/rc.d/netif stop em0
/etc/rc.d/netif start ath0


-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: switching from one network interface to another without reboot

2009-08-20 Thread Michal

Adam Vande More wrote:

/etc/rc.d/netif stop em0
/etc/rc.d/netif start ath0



Works like a charm, thank you so much.

Michal
--
Attacks always get better; they never get worse. -NSA
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: switching from one network interface to another without reboot

2009-08-20 Thread Mel Flynn
On Thursday 20 August 2009 03:25:17 Michal wrote:

 Problem description: I've got a laptop with two network interfaces
 (wired em0 and wireless ath0). Every now and then I have to set up a DSL
 wireless box which comes with default settings so that I have to start
 with connecting my laptop via em0.
 em0 gets IP address from wireless box by DHCP. I log in to web interface
 and set everything up including WLAN and restart wireless box. At this
 point I would like to switch to ath0 and start using internet connection
 via wireless box.
 I'm taking em0 interface down with ifconfig em0 down and unplug the
 cable. I'm changing /etc/rc.conf entries to:
 ifconfig_em0=NOAUTO
 ifconfig_ath0=WPA DHCP
 Then I'm doing /etc/rc.d/netif restart and ath0 gets IP address via
 DHCP and is connected to wireless box (/etc/wpa_supplicant.conf is set up).

If these are on the same network (like most wireless routers), it can pay off 
to use lagg(4) and then simply unplug the cable. Plug it back in and it will 
use the cable again. You would need:
cloned_interfaces=lagg0
ifconfig_em0=UP
ifconfig_ath0=ether 00:xx:xx:xx WPA # set to MAC address of em0
ifconfig_lagg0=laggproto failover laggport em0 laggport ath0 DHCP
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: switching from one network interface to another without reboot

2009-08-20 Thread Michal

Mel Flynn wrote:
If these are on the same network (like most wireless routers), it can pay off 
to use lagg(4) and then simply unplug the cable. Plug it back in and it will 
use the cable again. You would need:


In my case usually it's some testing environment so I needed more of a 
quick kludge. But thats very interesting idea for my home network, I'll 
definitely have to check it out, thanks!


Michal
--
If the facts don't fit the theory, change the facts. -Albert Einstein
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: switching from one network interface to another without reboot

2009-08-20 Thread b. f.
Michal wrote:
Mel Flynn wrote:
 If these are on the same network (like most wireless routers), it can pay off
 to use lagg(4) and then simply unplug the cable. Plug it back in and it will
 use the cable again. You would need:

In my case usually it's some testing environment so I needed more of a
quick kludge. But thats very interesting idea for my home network, I'll
definitely have to check it out, thanks!

And of course, you can also automate this via devd.conf(5), by
instructing the system to run the rc.d scripts or other
commands/scripts if one of your NICs is attached/detached, or upon
other conditions.  There are related examples in the devd.conf(5)
manpage and the default /etc/devd.conf

b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org