It is currently Wed Apr 14, 2021 11:52 pm

All times are UTC

Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Bridge with a Wireless NIC on Linux
PostPosted: Wed Oct 15, 2008 4:11 pm 
Site Admin

Joined: Sat Oct 11, 2008 1:41 pm
Posts: 2668
Location: Canada
HOWTO originally posted by rogan2929 on hacki's forum and adapted for GNS3.

So in short, your Linux box will need to be configured as a fully functional router with NAT. It will be forwarding packets between your wireless card and your loopback interface.

One more thing to note though, this guide will only work if you run GNS3 as root. Otherwise the program won’t be able to enumerate installed network interfaces.

To do this, you need to follow the steps outlined below.

For the purposes of this tutorial the wireless NIC will be called wlan0.


Install and configure the tap0 interface. An excellent guide is posted at ... et-router/. Look for the flash video called, “How to connect dynamips to a Linux tap interface”. This video assumes you’re running some version of Ubuntu / Debian. Other distributions should be able to find a similar package file, or at the very least get the source tarball.

If you’re feeling creative, add the line “tun” to your /etc/modules file and then add the tap0 interface to your /etc/network/interfaces file so that it loads on boot, it will save time. Otherwise you’ll have to manually configure the interface after each restart!

Here’s the relevant snippet from /etc/network/interfaces file:

auto tap0
iface tap0 inet manual
up ifconfig $IFACE netmask up
down ifconfig $IFACE down
tunctl_user root


The next step is to configure IPTables so that it automatically transfers packets between wlan0 and tap0. Here is a simple script that will do this. Keep in mind, it doesn’t have any real security built into it; it’s just used for playing with GNS3.

# Simple script to enable IP packet forwarding and NAT
# wlan0 is Internet connected interface

# Enable IP Forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

# Clean up iptables
iptables -F
iptables -t nat -F
iptables -X

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

# Set firewall policies

# Allow all connections not from wlan0
iptables -A INPUT -i ! wlan0 -j ACCEPT

# Allow all ICMP connections
iptables -A INPUT -p ICMP -j ACCEPT

# Allow all already established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

And that’s it. Very simple and straightforward. You still might need to configure your virtual router to send packets out the tap0 interface, however. If you’re not sure how to do that, pick up a book and start studying!

Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group