LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-23-2009, 12:54 PM   #1
andrews-mark
Member
 
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Rep: Reputation: 15
ethernet bridge for a LAN (ubuntu)


Hi - I have a problemo that is stumping me. I am trying to get a machine on a LAN to get to the internet. Seems quite like a standard problem, and its solution I presume involves an ethernet bridge. But so far, I have been unsuccessful.

The set up as follows (all machines are Ubuntu): Machine A has two NICs (eth0 and eth1). Machine B connects to Machine A through a switch connected to eth0. Machine A connects to internet via eth1. Machine A also is a dhcp server giving a local IP to Machine B. Here is a drawing
Code:
                           MACHINE A 
   MACHINE B <===========  ETH0 ETH1  =========> INTERNET
Machine A serves Machine B an Ip address via dhcp. So I can use, say, ssh to go from Machine A to Machine B and back without any trouble. However, what I also really want to do is to go from Machine B out into the internet. At the moment this is impossible. So, e.g. doing "ping www.somedomain.org" will work from Machine A but not from Machine B.

I have tried to build a bridge by getting "bridge-utils" on ubuntu and running the following commands on Machine A:
Code:
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo brctl addif br0 eth1
sudo brctl stp br0 on
where my interface set up for Machine A is as shown below.

If I do "sudo brctl show", I get
Code:
bridge name     bridge id               STP enabled     interfaces
br0             8000.0016e6ddae0c       yes             eth0
                                                        eth1
but this does not work and all it does is shut down any internet/intranet on Machine A, and I have to do "sudo brctl delbr br0" to get it back.

I'm out of options now.

My two main questions are
1) To get Machine B to talk to the internet in the above scenario is it necessary to make a ethernet bridge, or is some other method to be used, if so, what?
2) If an ethernet bridge is correct, is there something obviously wrong with my setup.

thanks in advance,
mark



Code:
andrews@wotan ~> cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth0 eth1
iface lo inet loopback

# The internet interface
iface eth1 inet static
        address 128.40.26.160
        netmask 255.255.255.0
        network 128.40.26.0
        broadcast 128.40.26.255
        gateway 128.40.26.245
        up route add default gw 128.40.26.245 dev $IFACE
        down route del default gw 128.40.26.245 dev $IFACE
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 144.82.100.1 144.82.100.41
        dns-search psychol.ucl.ac.uk

## The lan interface
iface eth0 inet static
        address 192.168.0.1
        netmask 255.255.255.0
        network 192.168.0.0
        up route add -net 192.168.0.0 netmask 255.255.255.0 dev $IFACE
        down route del -net 192.168.0.0 netmask 255.255.255.0 dev $IFACE
 
Old 11-23-2009, 01:54 PM   #2
samborambo
LQ Newbie
 
Registered: Dec 2004
Location: New Zealand
Distribution: Ubuntu LTS
Posts: 10

Rep: Reputation: 0
You need to set up NAT, not bridging, on machine A. There are plenty of howto's on setting up NAT in ubuntu.

Last edited by samborambo; 11-23-2009 at 01:56 PM. Reason: NAt, not port forwarding......half asleep....
 
Old 11-24-2009, 02:15 AM   #3
andrews-mark
Member
 
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Original Poster
Rep: Reputation: 15
many thanks for the tip on NAT. I'll look into it.
-m
 
Old 11-24-2009, 07:05 AM   #4
andrews-mark
Member
 
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Original Poster
Rep: Reputation: 15
indeed I was barking up the wrong tree with the ethernet bridge. Nat is what I wanted, and with a few lines in my /etc/rc.local, namely
Code:
sysctl -w net.ipv4.ip_forward=1
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o eth1 -j MASQUERADE
all is working now.

Many thanks to samborambo for the tip.

-m
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ethernet Bridge with Wireless and Physical LAN [half works] danfiggolfer Linux - Security 1 07-24-2007 02:33 PM
Is it possible to bridge ethernet and wifi? daishin Linux - Wireless Networking 1 10-06-2006 02:53 PM
try an ethernet to wireless bridge!! leec11 Linux - Wireless Networking 0 10-10-2004 09:42 PM
Network Bridge- IR to Ethernet systemparadox Linux - Networking 2 08-18-2004 08:51 AM
Ethernet Bridge bogging out finegan Linux - Networking 4 04-28-2004 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration