Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I pluged USB nano WiFi dongle because WiFi port buidin my laptop does not support AT/Master mode.
I just created script to run hostapd in bridge mode on it:
Code:
#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
brctl addbr br0
brctl addif br0 eth0
ip link set up dev br0
hostapd /etc/hostapd/hostapd.conf
Now my smartphone and tablet has commection to the rest of network, including corporate DHCP server. hostapd works like a charm.
But the laptop does not communicate with any network peer and Internet.
Below outputs from bridge status, netstat -rn and ifconfig/iwconfig.
Code:
[root@piotr-l ~]# brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.001e6825d575 no eth0
wlan1
[root@piotr-l ~]# ifconfig
br0 Link encap:Ethernet HWaddr 00:1E:68:25:D5:75
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:123 errors:0 dropped:8 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10992 (10.7 KiB) TX bytes:0 (0.0 b)
eth0 Link encap:Ethernet HWaddr 00:1E:68:25:D5:75
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4097 errors:0 dropped:0 overruns:0 frame:0
TX packets:3982 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3166761 (3.0 MiB) TX bytes:552943 (539.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:90 errors:0 dropped:0 overruns:0 frame:0
TX packets:90 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22916 (22.3 KiB) TX bytes:22916 (22.3 KiB)
wlan0 Link encap:Ethernet HWaddr 00:1F:3C:02:0F:C0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 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:0 (0.0 b) TX bytes:0 (0.0 b)
wlan1 Link encap:Ethernet HWaddr 7C:DD:90:5D:41:69
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:184 errors:0 dropped:0 overruns:0 frame:0
TX packets:178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30011 (29.3 KiB) TX bytes:111579 (108.9 KiB)
[root@piotr-l ~]# iwconfig
eth0 no wireless extensions.
wlan0 IEEE 802.11abg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=15 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
br0 no wireless extensions.
lo no wireless extensions.
wlan1 IEEE 802.11bgn Mode:Master Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
[root@piotr-l ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Whats wrong with hostapd startup script that it block whole laptop communication?
Barely twitching, it's not handling much traffic at all.
If you look, it hasn't polled an IP, so what it's doing is asking the other instances on the segment "what the hell is going on?" over UDP
You bridged the ethernet adapter, not the wireless adapter when you started. I might take the ethernet cable (the wire) out of the machine (don't actually yank it) and try to bring the wireless adapters up, then I'd go back and fix that bridge.
Maybe (or for sure) I do not correctly explain my problem.
My laptop has (as any) wired port eth0 and WiFi port (wlan0). WiFi does not support Master/AP mode. So it is impossible to run hostapd on it. In "normal state" my laptop is plugged to docking station and Ethernet cable is connected to that dock. And of course - works without problems.
WiFi coverage in my room is extremely poor (practically ZERO and newer will be better - dont ask me why ;-) ) but I want/must connect my smarthone and tablet to corporate network (including corporate DHCP service etc).
Because of that, I bought nano USB WiFi adapter RT5370 chipset based which fully support AP/Master mode and plugged it to USB port in docking station.
Next issue is that corporate DHCP server has MAC/IP restriction so both smartphone and tablet must obtain IP from corporate server. And - because of crazy net administrator - that addresses are changed daily (dont ask mi why....)
So I want to bridge traffic between wlan1 (plugged nano USB WiFi adapter) and eth0 to the rest of network.
The script from the first post activate hostapd on it and my smartphone and tablet works properly and obtain IP (and several additional parameters) from corporate DHCP server.
But laptop itself does not have any communication with the rest of network. Why? I dont understand. Bridge - works, but laptop lost communication. Look at the bridge state after running the script:
Code:
root@piotr-l ~]# brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.001e6825d575 no eth0
wlan1
So both eth0 and wlan1 are in the same bridge. wlan1 is automatically added to the bridge because of definition in hostapd.conf file.
Is it now more clear? If no I will post any info necessary to resolve that problem.
Last edited by mackowiakp; 03-29-2015 at 08:22 AM.
No, I now not only follow your process, but think it's a pretty cool solution. Question though
Quote:
The script from the first post activate hostapd on it and my smartphone and tablet works properly and obtain IP (and several additional parameters) from corporate DHCP server.
If they rely on the laptop for connectivity to the network DHCP server, and the laptop itself has no connectivity to the DHCP server...
Quote:
But laptop itself does not have any communication with the rest of network. Why? I dont understand. Bridge - works, but laptop lost communication.
If the laptop cannot connect to your companies network, then it's not bridging into it. Check to make sure that your call phone and tablet aren't just polling a DHCP lease from your companies servers via the weak wireless connection you mentioned earlier.
Not only is the wired connection apparently not working, based on what you're showing me from ifconfig, the wlan1 wireless connection isn't either. If you would, try a "tcpdump -c 50 | grep <your corporate networks first couple of octets, i.e. 192.168) " and see if there are actually any tcp packets coming across either interface. Post back what you find and we'll take a look at this.
My laptop is located in separate segment of network because of matter of my work. "Big Brother" is watching me constantly ;-). And room is electro-magnetically isolated too. But I am not Snowden ;-)
At this moment I am at home but I can post You necessary infos.
First of all, to avoid potential connection to unwanted Access Point, WiFi build in port wlan0 is physically turn off by hardware switch located on the front of laptop. Bluetooth is turn off to by the same switch. So the only way to communicate with the rest of network is wired interface. wlan1 interface is not started at all after boot so no connection could be done over wlan1. But additional WiFi USB adapter is plugged at this moment to laptop USB port.
During boot, laptop obtains IP address from my home DHCP server via wired that is the only active interface at this moment. And it works properly.
Than I start my script, and smartphone connects to hoatapd Access Point (as it is shown on console). Smartphone obtain DHCP info from home server (I have restriction MAC/IP address at home too) server because the only connection to the rest of network could be done over wired laptop port eth0.
I check IP address of smartphone - is correct as table in my home server stands (I dont use router build in DHCP but use DHCP from Linux based home server called - media).
Than I start browsing Internet using smartphone. Works without problem. But laptop lost connectivity to outside world.
Below outputs from ifconfig and iwfonfig after running my script that is - after activation hostapd:
Code:
[root@piotr-l ~]# ifconfig
br0 Link encap:Ethernet HWaddr 00:1E:68:25:D5:75
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:45 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4316 (4.2 KiB) TX bytes:0 (0.0 b)
eth0 Link encap:Ethernet HWaddr 00:1E:68:25:D5:75
inet addr:192.168.0.51 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:539 errors:0 dropped:0 overruns:0 frame:0
TX packets:510 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:324691 (317.0 KiB) TX bytes:74698 (72.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:127 errors:0 dropped:0 overruns:0 frame:0
TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:40311 (39.3 KiB) TX bytes:40311 (39.3 KiB)
wlan1 Link encap:Ethernet HWaddr 7C:DD:90:5D:41:69
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:3519 (3.4 KiB)
[root@piotr-l ~]# iwconfig
eth0 no wireless extensions.
wlan0 IEEE 802.11abg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=off
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
br0 no wireless extensions.
lo no wireless extensions.
wlan1 IEEE 802.11bgn Mode:Master Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
And output from tcpdump:
Code:
[root@piotr-l ~]# tcpdump -c50|grep 192.168.0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
20:09:14.473437 IP 192.168.0.2.17500 > 255.255.255.255.17500: UDP, length 147
20:09:14.473652 IP 192.168.0.2.17500 > 192.168.0.255.17500: UDP, length 147
20:09:32.213334 IP piotr-l.17500 > 192.168.0.255.17500: UDP, length 148
20:09:33.748096 IP media.17500 > 192.168.0.255.17500: UDP, length 147
50 packets captured
281 packets received by filter
220 packets dropped by kernel
[root@piotr-l ~]# tcpdump -c50|grep 192.168.0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
I have to mention once more, that wlan0 is physically disabled by hardware switch, smartphone connects to hostapd and obtain correct IP address from my home server and I can browse internet using smartphone but laptop - totally can not connect even to local network like ping to router, home server etc.
media is the name of my home server with DHCP server on it.
piotr-l is my laptop we are talking about
192.168.0.2 is my wife laptop.
Last edited by mackowiakp; 03-29-2015 at 01:40 PM.
Piotr, I'm stumped as you are on this one. I don't have a similar bridging arrangement I can reference and I'm not understanding at all how these appliances (phone/tablet) are poling DHCP leases through a gateway that doesn't reach the DHCP server. I'm not doubting a thing you're saying, I just don't understand it. Specifically, if you look at you adapter dump, you're passing nothing but UDP packets which wont route outside your network segment.
My best suggestion at this point is repost into the thread we started in so you pop up on unanswered threads list. The people who haunt this site who do this stuff for a living tend to watch that list, anything that goes over 24 hours, we take a look at it and see if we can be of help. It lets newer people sharpen their skills on easier questions.
I'll leave it alone this time and see if anybody else picks this one up. Meanwhile, I'm a putting couple servers in in my home environment today, Venerable Dells, but they have enough hyper-threads and sockets to virtually host complex networks, one of which I'm going to use to look at this problem. If I come up with something, I'll post back into this thread.
I wish I could be of more help to you but I gotta admit, I'm purely stumped on this one....
Sorry
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.