You are not logged in.

#1 2013-08-29 01:30:06

Davini
Member
From: Bozeman, MT
Registered: 2010-04-29
Posts: 41

[SOLVED] dhcpd + hostapd + netcfg, wired and wireless

Hello,

To start, I'd like to apologize if someone has already been able to do this, and I didn't look hard enough. I searched the forums and internet to find a solution to my problem but I was very unsuccessful. I basically want to set up a server to be both a wired and wireless router. Here is a crude diagram for the setup:

tmp.jpg

I basically want to share enp2s5 with both enp1s0 and w1p0s19f2u5u where enp1s0 handles wired connections and w1p0s19f2u5u2 handles wireless connections. I have successfully set up a dhcp server to handle the share for enp1s0 alone, as well as the share for w1p0s19f2u5u2 (provided by the wiki pages). Is it possible to somehow configure the dhcp server, hostapd, and netcfg to handle the setup I desire?

I was thinking about bridging enp1s0 and w1p0s19f2u5u2. That endeavor resulted in an error, leading me to a page describing how it is not possible to bridge a wired and wireless connection. I don't have the best background to deal with this kind of stuff.

My wireless interface is:

Bus 004 Device 005: ID 13b1:0031 Linksys AM10 v1 802.11n [Ralink RT3072]

Does anyone have any ideas?

Last edited by Davini (2013-08-29 03:21:50)

Offline

#2 2013-08-29 01:55:41

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [SOLVED] dhcpd + hostapd + netcfg, wired and wireless

Perhaps you should tell people what you've tried?

By the way, I can't see the image you posted - just the file name.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#3 2013-08-29 02:03:45

andy123
Member
Registered: 2011-11-04
Posts: 169
Website

Re: [SOLVED] dhcpd + hostapd + netcfg, wired and wireless

Davini wrote:

That endeavor resulted in an error, leading me to a page describing how it is not possible to bridge a wired and wireless connection. I don't have the best background to deal with this kind of stuff.
[…]
Does anyone have any ideas?

Yes, lots of them.

I neither have the best background, but why shouldn't it be possible to bridge a wired and wireless connection?

$ brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.0015afb8d6fa       no              eth0
                                                        wlan0

It's been a while since I have set this up, but I think these are the relevant config files: netctl profile

Description="wlan bridge"
Interface=br0
Connection=bridge
BindsToInterfaces=(enp1s0)
IP=static
Address=('192.168.178.21/24') # your enp1s0 ip
Gateway='192.168.178.1' # no idea?

hostapd.conf

interface=w1p0s19f2u5u2
bridge=br0
# more stuff that is most likely not relevant

With these it should work if you let the dhcp server listen on br0. Hope this helps.


i'm sorry for my poor english wirting skills…

Offline

#4 2013-08-29 02:14:11

progandy
Member
Registered: 2012-05-17
Posts: 2,143

Re: [SOLVED] dhcpd + hostapd + netcfg, wired and wireless

You should be able to bridge wlan and lan after your wlan interface is in access point mode.
I guess it works something like this:
- create netctl "bridge" profile and its ip settings.
- start hostapd with the bridge set in its config
- start netctl profile after hostapd
use systemd dependency management to order the services.

PS: Try it without wlan interface in the netctl bridge profile and start it before hostapd if it doesn't work.

Last edited by progandy (2013-08-29 02:16:10)

Offline

#5 2013-08-29 03:21:31

Davini
Member
From: Bozeman, MT
Registered: 2010-04-29
Posts: 41

Re: [SOLVED] dhcpd + hostapd + netcfg, wired and wireless

I'm not sure what I did, but when I originally used netctl to bridge the two interfaces, I got :

# Cannot assign requested address

after attempting to up the config. Maybe a restart after an upgrade? Honestly, I'm not sure how/why it works now. However,

----------------------------------

progandy wrote:

- create netctl "bridge" profile and its ip settings.
- start hostapd with the bridge set in its config
- start netctl profile after hostapd

That worked perfectly.

Thanks for the responses and candor in them. Arch users are awesome.

----------------------------------
The solution that worked for me.

/etc/hostapd/hostapd.conf

interface=wlp0s19f2u5u2
driver=nl80211
bridge=br0

logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2

dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel

ssid=test
wpa_passphrase=testtest

hw_mode=g
channel=3
max_num_sta=255
macaddr_acl=0
accept_mac_file=/etc/hostapd/hostapd.accept
deny_mac_file=/etc/hostapd/hostapd.deny
auth_algs=1
ignore_broadcast_ssid=0
wpa=2 # RSN only
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

/etc/dhcpd.conf

option subnet-mask 255.255.255.0;
option routers 1.2.3.1;
subnet 1.2.3.0 netmask 255.255.255.0 {
  range 1.2.3.2 1.2.3.255;
}

/etc/network.d/bridge

INTERFACE="br0"
CONNECTION="bridge"
BRIDGE_INTERFACES="enp1s0"
IP="static"
ADDR='1.2.3.1'

for systemd

# systemctl enable hostapd.service
# systemctl enable netcfg@bridge
# systemctl enable dhcpd4.service

Offline

#6 2013-08-29 03:27:51

progandy
Member
Registered: 2012-05-17
Posts: 2,143

Re: [SOLVED] dhcpd + hostapd + netcfg, wired and wireless

I'm not sure what I did, but when I originally used netctl to bridge the two interfaces, I got :

# Cannot assign requested address

after attempting to up the config. Maybe a restart after an upgrade? Honestly, I'm not sure how/why it works now. However,

A wireless interface has different modes, brctl cannot add it to a bridge if it is in client mode. You have to set it up as access point first. hostapd does that automatically.

Offline

Board footer

Powered by FluxBB