# Share Wi-Fi over Ethernet

## GSnake

Hello guys!

I tried to understand how to bridge my connection to my ethernet card but I failed.

Could someone please guide me in doing this (maybe explanating also WHY we're doing this and that?)

Thank you guys!

----------

## eccerr0r

It would help us more if you told exactly what hardware you have and what you're trying to do?

Because if you have a wireless access point it will automatically bridge to Ethernet, or at least it usually is designed that way.

----------

## khayyam

GSnake ...

my guess is that you are not really looking to bridge, but simply NAT traffic from one interface to the other in order to share the wireless connection on machine1 with machine2 connected via ethernet.

If both machines ethernet cards are Auto-MDIX capable then a regular cable can be used, if not then a cross cable will be required. Also, netfilter will be need to be enabled in the kernel of machine1 (including NF_NAT), and net-firewall/iptables installed.

I will assume that the network interface wlan0 in machine1 is established. The ethernet connection on machine1 and machine2 look like the following (here using Class C addressing, but these could be a local link addresses in the 169.254.0.0/16 range).

machine1:

```
config_eth0="192.168.2.1/24"
```

machine2:

```
config_eth0="192.168.2.2/24"

routes_eth0="default via 192.168.2.1"

dns_servers_eth0="xxx.xxx.xxx.xxx"
```

The DNS address could be the same as supplied via your wireless router, or ISP, or provided by machine1 (if you happen to run a local dns service, or dnsmasq).

On machine1 one you would then enable forwarding and set the NAT to masquerade traffic to wlan0

```
# echo 1 > /proc/sys/net/ipv4/ip_forward

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

.... and there you have it, an explanation would probably just confuse things, and there are plenty of tutorials out there on basic networking.

best ... khay

----------

## Ant P.

If you still want to bridge the interfaces, you should add wlan0 to the bridge first so that inherits its MAC address. Most wi-fi hardware I've used doesn't work properly with traffic addressed to something else.

----------

## John R. Graham

Split Windows XP networking advice to here in Off the Wall, if anyone cares.

- John

----------

