 |
 |
 |
 |
| Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc. |

4th October 2009, 09:19 PM
|
|
Registered User
|
|
Join Date: Oct 2009
Posts: 1

|
|
|
How to set up bridge? (wlan0-eth0)
I tried google but without success. I have a small home network and one computer has to work as a bridge (comp1), it connects to the internet through wlan and is connected with cable to other computer (comp2), I would like to to make that second computer member of a local network with internet access.
I was trying this:
Code:
ifconfig wlan0 0.0.0.0
ifconfig eth0 0.0.0.0
brctl addbr br0
brctl addif br0 wlan0
brctl addif br0 eth0
ifconfig br0 192.168.1.7 netmask 255.255.255.0 up
On comp1 I could ping a comp2 but I couldn't ping router and internet didn't work. In Network Manager wireless connection seemed to be connected.
Any idea how to solve that problem?
BTW I'm using Fedora 11.
|

5th October 2009, 09:20 AM
|
 |
Administrator
|
|
Join Date: Aug 2007
Location: London Postbox (the red one)
Age: 47
Posts: 3,847

|
|
Hi and Welcome,
This is something i have tried but without success  , im not much good at Networking 
So i hope someone can help you soon. (shameless bump  )
Dave
|

5th October 2009, 12:20 PM
|
 |
Retired Community Manager -- Banned from Texas by popular demand.
|
|
Join Date: Sep 2007
Location: NYC
Posts: 8,142

|
|
My way of doing it which has worked for me.
Code:
sudo brctl addbr br0
sudo ifconfig eth0 0.0.0.0
sudo brctl addif br0 eth0
sudo ifconfig br0 192.168.1.115 netmask 255.255.255.0 up
sudo route add -net 192.168.1.0 netmask 255.255.255.0 br0
sudo route add default gw 192.168.1.1 br0
__________________
--
http://home.roadrunner.com/~computertaijutsu
Do NOT PM forum members with requests for technical support. Ask your questions on the forum.
"I don't know why there is the constant push to break any semblance of compatibility" --anon
|

5th October 2009, 02:05 PM
|
 |
Registered User
|
|
Join Date: Jul 2009
Location: London,England
Posts: 1,095

|
|
There's no need to use a bridge, in Fedora 11 this is much easier.
Comp1 (Connected to internet via wlan0, connected to comp2 via cable from eth0)
================================================== ===
1. Open System -> Administration -> Firewall, and under 'Masquerading' select wlan0 (scroll down, if it's not there add it), then click 'Apply'
2. Set eth0 to ip 10.0.0.1, either via Network Manager or from the command line with
Code:
ifconfig eth0 10.0.0.1
(Assuming your wifi connection is in 192.168.*.* range)
Comp2 (Connected to Comp1 via cable from eth0)
=================================
1. Stop NetworkManager service since it's easier without:
Code:
service NetworkManager stop
2. Set eth0 ip address to 10.0.0.2 and default gateway to 10.0.0.1:
Code:
ifconfig eth0 10.0.0.2
route add default gw 10.0.0.1
Check you can ping 10.0.0.1, and an external ip such as 4.2.2.4
3. Now just set a DNS address in /etc/resolv.conf, eg if comp1 has dns address 192.168.1.1 then just put this line in /etc/resolv.conf
Code:
nameserver 192.168.1.1
(if unsure use a free external DNS like 4.2.2.x, x=1..6)
That's it, easy enough to script. I have to do this sometimes when I have no wifi connection on a portable machine and it's easier to plug into a internet connected laptop rather than the router, which is behind furniture.
|

5th October 2009, 02:14 PM
|
 |
Registered User
|
|
Join Date: Jul 2009
Location: London,England
Posts: 1,095

|
|
|
Note: if you have set up a bridge then remove it with 'brctl delbr br0'
|

5th October 2009, 03:42 PM
|
 |
Registered User
|
|
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300

|
|
I'm with Godel - a bridge it's the ideal way to create forwarding.
I have no idea what
Quote:
|
1. Open System -> Administration -> Firewall, and under 'Masquerading' select wlan0 (scroll down, if it's not there add it), then click 'Apply'
|
Does, but something needs ot setup ip forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward
It's also a nice idea to use dnsmask to serve dhcp on the local net.
Code:
WAN=eth0
LAN=eth1
LANIP="192.168.133.1"
DHCPRANGE="192.168.133.2,192.168.133.253"
# setup forwarding and the dnsmasq service
fwd() {
iptables -A FORWARD -i $LAN -j ACCEPT
iptables -A FORWARD -o $LAN -j ACCEPT
iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig $LAN $LANIP/24 up
/usr/sbin/dnsmasq -C /dev/null >/dev/null 2>&1 \
--bind-interfaces \
--listen-address=$LANIP \
--dhcp-range=$DHCPRANGE,12h \
echo "to disable: $0 -d WAN=$WAN LAN=$LAN"
}
# remove forwarding and the dnsmasq service
unfwd() {
pkill -9 dnsmasq
ifconfig $LAN down
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -D FORWARD -i $LAN -j ACCEPT
iptables -D FORWARD -o $LAN -j ACCEPT
iptables -t nat -D POSTROUTING -o $WAN -j MASQUERADE
}
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
|

5th October 2009, 04:04 PM
|
 |
Registered User
|
|
Join Date: Jul 2009
Location: London,England
Posts: 1,095

|
|
Quote:
Originally Posted by stevea
Does, but something needs ot setup ip forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward
|
when you apply the masquerade setting in the firewall it automagically enables ip_forwarding for you (ip4 only) so you don't have to do it manually.
Masquerading is a very useful but not so well known feature in fedora's firewall gui, perhaps they should call it something more friendly like Internet Sharing
btw, it's also a very useful way to connect a from a terminal session to a wpa protected wifi network, you basically use a netbook as a wifi dongle connected via the rj45 port.
|

2nd December 2010, 03:42 AM
|
|
Registered User
|
|
Join Date: Aug 2008
Posts: 35

|
|
|
Re: How to set up bridge? (wlan0-eth0)
This can be simplified some since it appears network manager has a share option.
So replace step 2 with
2. Right click on Network Manager icon and select edit connections.
3. Under wired tab click add
4. Connection name: share
Under IPv4 Settings: Method: Shared to other computers
Check "Available to all users" and "Connect automatically" and click apply
eth0 will now be setup as a dhcp server and no configuration on Comp2 is needed.
Quote:
Originally Posted by Gödel
There's no need to use a bridge, in Fedora 11 this is much easier.
Comp1 (Connected to internet via wlan0, connected to comp2 via cable from eth0)
================================================== ===
1. Open System -> Administration -> Firewall, and under 'Masquerading' select wlan0 (scroll down, if it's not there add it), then click 'Apply'
2. Set eth0 to ip 10.0.0.1, either via Network Manager or from the command line with
Code:
ifconfig eth0 10.0.0.1
(Assuming your wifi connection is in 192.168.*.* range)
Comp2 (Connected to Comp1 via cable from eth0)
=================================
1. Stop NetworkManager service since it's easier without:
Code:
service NetworkManager stop
2. Set eth0 ip address to 10.0.0.2 and default gateway to 10.0.0.1:
Code:
ifconfig eth0 10.0.0.2
route add default gw 10.0.0.1
Check you can ping 10.0.0.1, and an external ip such as 4.2.2.4
3. Now just set a DNS address in /etc/resolv.conf, eg if comp1 has dns address 192.168.1.1 then just put this line in /etc/resolv.conf
Code:
nameserver 192.168.1.1
(if unsure use a free external DNS like 4.2.2.x, x=1..6)
That's it, easy enough to script. I have to do this sometimes when I have no wifi connection on a portable machine and it's easier to plug into a internet connected laptop rather than the router, which is behind furniture.
|
|

14th June 2011, 10:03 PM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 1

|
|
|
Re: How to set up bridge? (wlan0-eth0)
How to do it in KDE?
---------- Post added at 01:03 AM ---------- Previous post was at 12:07 AM ----------
I got it working in KDE 4.6.3, f15 64bit
Just create a new wired connection and choose Shared method. That's all.
|

11th November 2011, 06:49 AM
|
|
Registered User
|
|
Join Date: Nov 2011
Posts: 1

|
|
|
Re: How to set up bridge? (wlan0-eth0)
I used Godel's method and yes it's working fine  .
But there is one problem.
My 10.0.0.0 network is able to access my 192.168.2.0 network.
Bu the reverse is not happening.
I checked firewalls on both the systems, but i couldn't find a solution?
Do I need to add any manual route?
|

11th November 2011, 09:04 AM
|
 |
Registered User
|
|
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300

|
|
|
Re: How to set up bridge? (wlan0-eth0)
Yes, each system on the 192.168.2.* network has to route it's 10.0 addresses through "comp1"'s 192.168.2* wlan0 interface. So assuming comp1's wlan0 ip is 192.168.2.7 then every OTHER system on the 192.168.2* LAN should use:
sudo ip route add 10.0.0.0/16 via 192.168.2.7
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
|

11th November 2011, 10:49 AM
|
 |
Registered User
|
|
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300

|
|
|
Re: How to set up bridge? (wlan0-eth0)
Quote:
Originally Posted by bart3005
|
Except everyone agreed that a bridge is NOT the was to address this problem.
The OP used a bridge and it was suggested all around that's not a good approach.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
|

16th December 2011, 08:08 PM
|
|
Registered User
|
|
Join Date: Dec 2011
Location: garage
Posts: 3

|
|
|
Re: How to set up bridge? (wlan0-eth0)
Quote:
Originally Posted by Gödel
There's no need to use a bridge, in Fedora 11 this is much easier.
Check you can ping 10.0.0.1, and an external ip such as 4.2.2.4
|
That's where it stops working for me. I can ping 10.0.0.1 but not the external IPs. And ip_forward 1 or 0 doesn't help either...
Thanks.
|

16th December 2011, 11:07 PM
|
 |
Registered User
|
|
Join Date: Jul 2009
Location: London,England
Posts: 1,095

|
|
|
Re: How to set up bridge? (wlan0-eth0)
Quote:
Originally Posted by Dimon22
That's where it stops working for me. I can ping 10.0.0.1 but not the external IPs. And ip_forward 1 or 0 doesn't help either...
Thanks.
|
So let's just check: the internet connected computer has wifi on wlan0 with an 192.168.*.* address and you have set masquerading for wlan0 in the firewall gui. Then you have set eth0 on the internet connected computer to 10.0.0.1.
Now, on the other computer you have disabled NetworkManager, set eth0 to 10.0.0.2 and added the gateway (route add default gw 10.0.0.1) and there were no errors?
Can you ping 4.2.2.4 from the internet connected computer?
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 01:58 (Monday, 20-05-2013)
|
|
 |
 |
 |
 |
|
|