Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My Questions

Given: a tower running Ubuntu with: wan0) an ethernet interface connected to the 'WAN' which is my internet source; eth0) an ethernet interface connected to my (not yet extant) LAN; and wl0) a wireless interface.

1) How do I bridge wan0 and eth0 transparently as if I were using a router in Bridge Mode?

2) How do I bridge wan0 and eth0 such that the tower is acting like a router, providing internet, creating a subnet, routing, etc?

3) How do I create a WPA or WPA2 network on wl0 with hostapd?


Background

I have a tower I'm using as a server. Where I live, I am part of a controlled LAN (referred to as the WAN). The IT of this WAN registers computers, track use, ensure compliance, etc via MAC addresses. There are many end-users in the WAN, most of whom I don't know or trust. I want to create a LAN within this WAN so that I can protect myself and my network devices, with the caveat that the WAN sees each device, at least with respect to traffic. (You can try to convince me that this is not what I want, but I doubt you will sway me.)

The box currently has Ubuntu and Gentoo on it. Gentoo doesn't boot for kernel config reasons, but once I fix that, I plan for Gentoo to be the primary OS. I have two wired interfaces and one wireless. The wireless is an Ralink RT2760. I know this supports master mode via hostapd.


Problems

That I've had with implementing 1-3

1) With my experiments, either wan0 or eth0 had internet. What I mean by this is that either the tower had internet access, or the computer connected to eth0 had internet access.

2) Never got the DHCP voodoo working, not to mention routing. Not sure I have any idea what I was doing.

3) I created a network with SSID test, but my laptop wouldn't connect to it (connection timed out). It was broadcasting as an AP.


Final Words

I want to use command line tools, daemons, .conf files, etc, because I have never had any luck at all getting things like Network Manager to work.


# lspci -s 03:02 -vvv

03:02.0 Network controller: Ralink corp. RT2760 Wireless 802.11n 1T/2R Cardbus
    Subsystem: Ralink corp. Device 2760
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 64 (500ns min, 1000ns max), Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 22
    Region 0: Memory at febf0000 (32-bit, non-prefetchable) [size=64K]
    Capabilities: [40] Power Management version 3
        Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
        Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
    Kernel driver in use: rt2800pci
    Kernel modules: rt2800pci
share|improve this question

1 Answer 1

up vote 0 down vote accepted

My two ethernet interfaces are named wan0 and eth0. My wireless interface is named wl0. You will need to run: apt install bridge-utils

#/etc/network/interfaces

# Loopback
auto lo
iface lo inet loopback

# Auto
auto wan0
auto eth0
auto wl0
auto br0

# Physical Interfaces
iface wan0 inet manual
iface eth0 inet manual
iface wl0 inet manual
    pre-up iw dev wl0 set type __ap

# Bridge
iface br0 inet dhcp
    bridge_ports wan0 eth0 wl0

2) Still not sure

3) Install (if it's not) hostapd

#/etc/hostapd/hostapd.conf

interface=wl0
bridge=br0
drive=nl80211

ssid=my_network
hw_mode=g
channel=1

wme_enabled=1
ieee80211n=1
ht_capab=[HT40+][SMPS-STATIC]

macaddr_acl=1
accept_mac_file=/etc/hostapd/accept

auth_algs=1
ignore_broadcast_ssid=1
wpa=2
wpa_passphrase=my_pass
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise-CCMP
share|improve this answer
    
Where do all these lines of configuration go? –  Simon Sheehan Feb 13 '12 at 21:25
    
Those are (slightly edited) versions of /etc/network/interfaces and /etc/hostapd/hostapd.conf respectively. Also, ht_capab and hostapd in general are device specific. To tell if you can use hostapd, run apt install iw and then iw list. You should see Supported interface modes:. If * AP appears below that, hostapd can turn your card into an AP. I know ht_capab could have a lot more to it, but I don't know how to figure out what all my card supports. If iwconfig wl0 mode master does not give you an error, then that might be the way to go.I'm using an RT2760. –  FireLizzard Feb 13 '12 at 21:31
    
You should hit the EDIT button on your answer and add that in –  Simon Sheehan Feb 13 '12 at 21:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.