You are not logged in.
Hi. I'm trying to set up an archlinux box as a wireless router. It has an external interface
eth0
and an internal one:
wlan0
The router will be 192.168.1.1, netmask 255.255.255.0, broadcast 192.168.1.255.
Now, to clear up any misthinking, I am trying to connect to it only through wlan0, external networking is not supposed to work (yet). For this, my hostapd.conf looks like this:
/etc/hostapd/hostapd.conf:
interface=wlan0
ssid=foobar
driver=nl80211
(no encrpytion whatsoever)
I still have to do:
ifconfig wlan0 192.168.1.1 up
otherwise it doesn't work. (Side question: Any idea how to fix this, ideally by instructing hostapd to do it?)
Of course there are other settings as well, but they're irelevant (the defaults anyway), as everything works when i do on another machine (external interface wlan0)
iwconfig wlan0 essid foobar
ifconfig wlan0 192.168.1.2 up
route add default gw 192.168.1.1 (not needed, but I've put it for the sake of completeness)
ping 192.168.1.1 (it works)
iwconfig wlan0 (shows me master mode on the router - yep the network card supports it)
ssh root@192.168.1.1 (yup, this works too)
Great. So I've learned how to configure and establish a wireless connection manually between two nodes.
So let's restart the machine (I could remove things manually, BUT I want to emphasise that I've tried to keep it as clean and interference-free as possible, so no messing with anything here), then proceed to the next step:
----------------------------
The Problem
----------------------------
Just to make it clear, no networking is enabled at boot time, so "ifconfig" will only show the loopback interface.
I issue the commands:
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl setfd br0 0
/etc/rc.d/hostapd start
ifconfig wlan0 192.168.1.1 up
brctl addif br0 wlan0
ifconfig eth0 up
ifconfig br0 up
dhcpcd br0
Everything works so far, it gets an IP (192.168.2.6) via dhcp from 192.168.2.1 (that's what I would call "the internet" - it's just yet another cheap router which will be replaced by the current router), the interfaces are up:
ifconfig:
br0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.2.6 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: xx:xx:xx:xx:xx:xx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:143 errors:0 dropped:0 overruns:0 frame:0
TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15428 (15.0 Kb) TX bytes:8156 (7.9 Kb)
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet6 addr: xx:xx:xx:xx:xx:xx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9964 (9.7 Kb) TX bytes:8848 (8.6 Kb)
Interrupt:40 Base address:0x4000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:672 (672.0 b) TX bytes:672 (672.0 b)
mon.wlan0 Link encap:UNSPEC HWaddr xx:xx:xx:xx:xx:xx-00-00-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:40 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2182 (2.1 Kb) TX bytes:0 (0.0 b)
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: xx:xx:xx:xx:xx:xx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:108 errors:0 dropped:0 overruns:0 frame:0
TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8166 (7.9 Kb) TX bytes:12996 (12.6 Kb)
routes:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 204 0 0 br0
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
default 192.168.2.1 0.0.0.0 UG 204 0 0 br0
But now on the remote testbox (inside the LAN), pinging won't work after I do:
iwconfig wlan0 essid foobar
ifconfig wlan0 192.168.1.2 up
iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11bg ESSID:"foobar"
Mode:Managed Frequency:2.457 GHz Access Point: xx:xx:xx:xx:xx:xx
But as you can see, it is connected to the AP.
(all the MAC addresses have been stripped off).
----------------------------------------
As you can see, I've done my homework as best as I could. Is there any guru who can help me out? Ideally, someone who has done it before.
Last edited by Flavious (2011-02-25 12:55:37)
Offline
Are you using network daemon right? I believe you already have hostapd.conf: configured, then try this:
rc.conf
wlan0="wlan0 up"
eth0="eth0 up"
br0="br0 192.168.0.1 netmask 255.255.255.0 up" <--- put your bridge ip there
INTERFACES=(wlan0 eth0 br0)
DAEMONS=(... hostapd network ...)
/etc/conf.d/bridges
bridge_br0="wlan0 eth0"
BRIDGE_INTERFACES=(br0)
Last edited by oTarUX (2011-02-25 13:11:33)
Circa mea pectora multa sunt suspiria
De tua pulchritudine, que me ledunt misere.
Tui lucent oculi sicut solis radii,
Sicut splendor fulguris, qui lucem donat tenebris.
Offline
Are you using network daemon right?
I'm not using any daemon, the commands I've shown are put in scripts, because first I want to get it working while understanding how it works.
After that I'm going to integrate it into the archlinux boot process.
I'm going to test that, though I'm not sure what the "bridge ip" should be, 192.168.1.1 or 192.168.2.6 (which I would normally get from "the internet" via dhcp - from 192.168.2.1)?
Offline
oTarUX wrote:Are you using network daemon right?
I'm not using any daemon, the commands I've shown are put in scripts, because first I want to get it working while understanding how it works.
After that I'm going to integrate it into the archlinux boot process.
I'm going to test that, though I'm not sure what the "bridge ip" should be, 192.168.1.1 or 192.168.2.6 (which I would normally get from "the internet" via dhcp - from 192.168.2.1)?
Sorry, I've missed that. Maybe br0="dhcp" in rc.conf instead of br0="br0 192.168.0.1 netmask 255.255.255.0 up".
Circa mea pectora multa sunt suspiria
De tua pulchritudine, que me ledunt misere.
Tui lucent oculi sicut solis radii,
Sicut splendor fulguris, qui lucem donat tenebris.
Offline
Yep I've got one step further with your help, now at least networking from the router to the "internet" works.
However it exhibits the same behavior when I try to connect from my local testbox to the router: the access point is shown correctly by iwconfig (identified by the right mac address), but I cannot ping the router.
The strange thing is after hostapd and network are started (in that order), wlan0 still doesn't have any ip address. I've also tried to
ifconfig wlan0 192.168.1.1 up
after the daemons have been started, the same problem.
Addendum:
I've also tried to set it in rc.conf: wlan0="wlan0 192.168.1.1 up", same thing happens.
Last edited by Flavious (2011-02-25 14:25:13)
Offline
It shouldn't have an ip, bridge does. Both interfaces (eth0 and wlan0) are now working as one (br0). How did you get your ip on the client?
Circa mea pectora multa sunt suspiria
De tua pulchritudine, que me ledunt misere.
Tui lucent oculi sicut solis radii,
Sicut splendor fulguris, qui lucem donat tenebris.
Offline
ifconfig wlan0 192.168.1.1 up
on the client (the laptop).
Note: that's what I had to do to get a point-to-point connection between the laptop and the router, as I've described in the first part of the first post.
Addendum:
There is no DHCPd running on the router (yet). First I want to get it working with static ip addresses.
It shouldn't have an ip, bridge does. Both interfaces (eth0 and wlan0) are now working as one (br0). How did you get your ip on the client?
And yes, as I said, I tried it first without setting 192.168.1.1 as the ip of wlan0 on the router. Not having it working in the first place first determined me to also try to set it.
Last edited by Flavious (2011-02-25 14:43:21)
Offline
ifconfig wlan0 192.168.1.1 up
on the client (the laptop).
Note: that's what I had to do to get a point-to-point connection between the laptop and the router, as I've described in the first part of the first post.
Addendum:
There is no DHCPd running on the router (yet). First I want to get it working with static ip addresses.
oTarUX wrote:It shouldn't have an ip, bridge does. Both interfaces (eth0 and wlan0) are now working as one (br0). How did you get your ip on the client?
And yes, as I said, I tried it first without setting 192.168.1.1 as the ip of wlan0 on the router. Not having it working in the first place first determined me to also try to set it.
Same ip on the router and the client? maybe different subnets?
If you still get 192.168.2.6 as your router ip try setting 192.168.2.20 con your client.
Circa mea pectora multa sunt suspiria
De tua pulchritudine, que me ledunt misere.
Tui lucent oculi sicut solis radii,
Sicut splendor fulguris, qui lucem donat tenebris.
Offline
Oh sorry typo I ment 192.168.1.2
The internal LAN from the POV of the router is 192.168.1.x, from "the outside" I get 192.168.2.x.
Offline
Try setting your LAN as 192.168.2.XXX
Circa mea pectora multa sunt suspiria
De tua pulchritudine, que me ledunt misere.
Tui lucent oculi sicut solis radii,
Sicut splendor fulguris, qui lucem donat tenebris.
Offline
Why? Then the internal LAN IPs would collide with the "internet" ones.
Last edited by Flavious (2011-02-25 15:46:35)
Offline
I had exactly the same problem this chrismas
Overall, I can say that it's not worth it (performance impact), but is a great lesson...
Are you trying to set up a bridge or a router? Where is your dnsmasq config? Ohh, and what is your wireless card?
EDIT: My post: https://bbs.archlinux.org/viewtopic.php?id=110664
Last edited by Leonid.I (2011-02-25 16:05:24)
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
Have you got it working by following this:
put your dhcp server and access point in the same subnet.
or what else?
Are you trying to set up a bridge or a router?
A router. Am I missing any puzzle piece in the process?
No NAT for now, only static ip addresses (just to keep the learning curve low, so I can actually digest everything I learn) and routing.
I won't even think about DNS, DHCP or something else until I get it working with static ip addresses and manually pinging and connecting (via IP addresses).
It doesn't make sense to go the "easy" way, I want to be able to type in every command and learn from that (a lot).
Last edited by Flavious (2011-02-25 19:58:04)
Offline
the ip for the "internet" should be gotten from your isp. it may be 55.66.77.88 but will never be 192.168.1.xx. you can see the wiki for "software access point".
Offline
the ip for the "internet" should be gotten from your isp. it may be 55.66.77.88 but will never be 192.168.1.xx. you can see the wiki for "software access point".
My routers are daisy chained, from the POV of the router, I get the IP from "the outside", which happens to be yet another router (which I've never talked about, it's simply "the internet" for me)
So my router does indeed get a good IP.
I still cannot do both at the same time: connect via wireless to the router, and have internet access from the router to "the internet".
So is there any networking guru around who could have something meaningful to say, please?
Offline
in the wiki, there is one step missing, you need to put a "1" in /proc/sys/net/ipv4/ip_forward. i don't know where and when to put it in the wiki.
echo 1 > /proc/sys/net/ipv4/ip_forward
may be this can help.
Offline
in the wiki, there is one step missing, you need to put a "1" in /proc/sys/net/ipv4/ip_forward. i don't know where and when to put it in the wiki.
echo 1 > /proc/sys/net/ipv4/ip_forward
may be this can help.
That's set in /etc/sysctl.conf
Offline
chancho wrote:in the wiki, there is one step missing, you need to put a "1" in /proc/sys/net/ipv4/ip_forward. i don't know where and when to put it in the wiki.
echo 1 > /proc/sys/net/ipv4/ip_forward
may be this can help.
That's set in /etc/sysctl.conf
Also, one needs to set /proc/sys/net/bridge/bridge-nf-* to 0, in order to avoid slowdowns because of packet filtering.
Here is a catch though: in rc.multi /etc/sysctl.conf is read before hostapd is woken up. Thus, bridge-related settings will be ignored. I would put additional "sysctl -p" into rc.local.
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline