First, I'll explain my homesetup, and what I want:
I have an ISP who provides 2 public ip addresses (dynamically). My ISP checks the connected pc's on MAC addresses, so for example; if my laptop and desktop are connected to the internet, I cannot disconnect my laptop and add another desktop to the network, because the MAC address.
For now, I'm using a laptop and a desktop, connected to a switch. That switch is connected to the modem. So far, so good. Actually, I want to use the wireless for my laptop. But (the most important), I want to have one of the public ip addresses of my ISP.
If I use a random accesspoint, the accesspoint will take an ip address. The desktop will take an ip address. And, hm, my laptop does not have an ip address anymore.
I don't wanna use some router-system where my laptop would have some internal ip, because I want my laptop to be directly available on the internet, without some stupid routerthing. Off course, my laptop would be the only computer on the wireless.
My question: Is there a way to use some kind of accesspoint/bridge/whatever where my laptop can have an external ip address.
Oh, and excuse me for the bad english...
Oh, The thing I need would be some "wireless cable". Some thing I plugin to my switch, and "translates" the wireless signals to wired signals and vice versa. Some thing that don't needs an ip (or maybe once in the beginning, to set up the essid, password,...)
I'd use a router. So much easier... why do you honestly need your laptop directly connected?
I agree that going with a router would simplify things a great deal. If you want your laptop to be accessible to the outside world, you can just set up port forwarding rules to account for that and use something like dyndns.com or no-ip to ensure that you have a static address you can use even though your ISP provides dynamic IP addresses.
Hm, indeed, a router will be easier. Actually, I will using this setup:
cablemodem ------- hub ------- w-router -------- desktop | +~~~~~~~~~~~~ laptop +----------------------------laptop
Where --- is a wired link, ~~~ is a wireless link. Laptop and laptop are in fact the same laptop, but in the drawing they represent both interfaces.
As since the cablemodem is providing me two external ip addresses, the wireless router will get one, and my laptop's wired interface will get one. The desktop is wired connected to the wireless router and will get an internal ip. The laptop will also wireless be connected with the wirless router and the wireless interface will get an internal ip.
So far, so good. I've tested the setup with the wireless router of the neighbour, and it seems to work, except for one "point".
When i start the laptop lan0 starts and is connected via the hub to the cablemodem and gets an external ip. Once I start the wireless interface, the wireless interface gets an internal ip, and is also be connected. But, I see that all trafic is routed trough the wireless interface. The cable is not being used anymore.
Maybe you see the point? When my laptop is connected to a) both wired and wireless or b) to wired only; I want my laptop to route all trafic trough the wired network, cince it is _a lot_ faster than wireless. But, when I disconnect the cable for let's say, taking a walk with the laptop, I want it to be connected trough wireless directly. Once I'm back on my desk and plug the cable back into the laptop, I want the laptop to use the wired conenction again.
If possible, I'd like it if the switching between wireless and wired is as transparent as possible. Not that that I will keep surfing while moving my laptop tough, but I'd like it that for example downloads continue downloading. A little lag may occur for 5 seconds or something like that, but I don't want to have all my connections reset after switching.
My final question: How do I setup such a thing? I have been looking into /etc/ifplugd/ifplugd.action, /etc/conf.d/dhcpd, /etc/conf.d/wireless, etc, but I cannot figure this out by myself...
output of "route" when connected to wired only:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 220.127.116.11 * 255.255.255.0 U 0 0 0 lan0 default dD5777001.acces 0.0.0.0 UG 0 0 0 lan0
output of "route" when connected to both wired and wireless:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 18.104.22.168 * 255.255.255.0 U 0 0 0 lan0 192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0 default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 default 22.214.171.124 0.0.0.0 UG 0 0 0 lan0
So, I guess I'll need to have something that manages my gateway's. But like I said, I cannot figure that out by myself.
Somebody has an idea or a solution?
Problem is solved after a few hours trying .
I have a script to setup wireless connection to the router while configuring my routes on such a way that only the wired connection of the laptop will be used.
#!/bin/sh echo "shutting down wlan0... " ifconfig wlan0 down echo "-> done" echo "adding to $1..." iwconfig wlan0 essid $1 nickname laptop echo "-> done" echo "starting wpa_supplicant..." killall -9 wpa_supplicant wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant.conf -dddd >& /var/log/wpa.log & echo "-> done" echo "starting up wlan0..." ifconfig wlan0 up echo "-> done" echo "asking for an ip..." if [ -e "/etc/dhcpc/dhcpcd-wlan0.pid" ] ; then rm /etc/dhcpc/dhcpcd-wlan0.pid fi dhcpcd wlan0 echo "-> done" echo "fixing route..." route del default gw 192.168.1.1 echo "-> done"
I editted /etc/ifplugd/ifplugd.action on such a way that when disconnecting the cable, the wireless router is set as default gateway. When the cable is plugged in again, the default gateway to the router is removed.
(...) up) ifup $1 /sbin/route add $gateway /sbin/route del default gw 192.168.1.1 ;; down) ifdown $1 /sbin/route del $1 /sbin/route add default gw 192.168.1.1 ;; *) echo "Wrong arguments" > /dev/stderr ;; (...)
Onfortunaly, connections such as ftp and msn are lost. But that's not that bad.