View previous topic :: View next topic |
Author |
Message |
nilecirb Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 15 Jan 2004 Posts: 127
|
Posted: Mon Feb 27, 2006 1:59 am Post subject: Bridge or Route Wired/Wireless NICs? [Solved] |
|
|
My laptop has two NICs: one wired, the other wireless. I have successfully configured both (with static IP), and now I would like to set up my laptop so that my desktop can connect to my laptop via the wired NIC, while my laptop forwards those packets via the wireless to my wireless router. Meanwhile, I would like my laptop to retain its connection to the router so that I can still use the internet. After researching, I discovered that a bridge might serve my purpose. After emerging bridge-utils and reading the documentation, I attempted to set up a bridge between my wireless and wired NICs on my laptop. However, while both NICs work fine independently, when I add them to the bridge, neither works as intended.
I set the bridge up with Code: | brctl addbr br0
brctl addif ath0
brctl addif eth0
ifconfig ath0 0.0.0.0
ifconfig eth0 0.0.0.0
ifconfig br0 up |
Would bridging my two NICs solve my problem? Thanks for any assistance.
Last edited by nilecirb on Tue Feb 28, 2006 8:04 am; edited 2 times in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JeliJami Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/148526789243d7753a09b11.jpg)
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
Posted: Mon Feb 27, 2006 12:40 pm Post subject: |
|
|
just config your laptop to be a router:
Code: | # iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# echo "1" > /proc/sys/net/ipv4/ip_forward |
(replace wlan0 with your wireless NICs name)
and use your laptop's wired IP address as default gateway on your desktop _________________ Unanswered Post Initiative | Search | FAQ
Former username: davjel |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nilecirb Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 15 Jan 2004 Posts: 127
|
Posted: Tue Feb 28, 2006 6:48 am Post subject: |
|
|
Thanks for replying, davjel. Since I configured net.ath0 already, I performed the following commands: Code: | /etc/init.d/net.ath0 start
iptables -t nat -A POSTROUTING -o ath0 -j MASQUERADE
echo "1" > /proc/sys/net/ipv4/ip_forward
ifconfig eth0 192.168.2.1 |
However, that does not work. How exactly does eth0 (or any ethernet device, for that matter) know to access ath0 for its gateway? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JeliJami Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/148526789243d7753a09b11.jpg)
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
Posted: Tue Feb 28, 2006 7:08 am Post subject: |
|
|
on your laptop, make sure to set the default gateway to the wireless router (over ath0)
Code: | [root@laptop]# route add default gw <ip of wireless router> |
on the machines that are connected via eth0 (wired), make sure to set the default gateway to the wired NIC
Code: | [root@otherPC]# route del default
[root@otherPC]# route add default gateway 192.168.2.1 |
_________________ Unanswered Post Initiative | Search | FAQ
Former username: davjel |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nilecirb Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 15 Jan 2004 Posts: 127
|
Posted: Tue Feb 28, 2006 7:21 am Post subject: |
|
|
Since the desktop is a Windows box, I manually entered the IP 192.168.2.2, subnet mask 255.255.255.0, and gateway 192.168.2.1, with the DNS pointing to 192.168.2.1. However, I still can't access the internet from it.
The following is the output of route from the laptop: Code: | Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 ath0
loopback localhost 255.0.0.0 UG 0 0 0 lo
default 192.168.1.1 0.0.0.0 UG 0 0 0 ath0 |
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JeliJami Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/148526789243d7753a09b11.jpg)
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
Posted: Tue Feb 28, 2006 7:55 am Post subject: |
|
|
nilecirb wrote: | ...with the DNS pointing to 192.168.2.1. However, I still can't access the internet from it. |
Does this laptop run a dns server or dns proxy?
If not, just use your regular DNS server (your ISP's ?).
Try to ping 192.168.2.1 from the windows box.
If that's OK, try to ping 192.168.1.1 from the windows box.
If that's OK, you should be able to ping for example 1.1.1.1 from the windows box. _________________ Unanswered Post Initiative | Search | FAQ
Former username: davjel |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nilecirb Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 15 Jan 2004 Posts: 127
|
Posted: Tue Feb 28, 2006 8:01 am Post subject: |
|
|
At first I thought that the laptop would act as a DNS server, but after you suggested I use my regular one, everything worked wonderfully. Thanks a lot for your help, davjel! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JeliJami Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/148526789243d7753a09b11.jpg)
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|