Linux Commands Examples

A great documentation place for Linux commands

bridge

show / manipulate bridge addresses and devices


see also : ip

Synopsis

bridge [ OPTIONS ] OBJECT { COMMAND | help }

OBJECT := { fdb | monitor }

OPTIONS := { -V[ersion] | -s[tatistics]

bridge fdb { add | del } LLADDR dev DEV { local | temp } { self } { embedded }

bridge fdb [ show ] [ dev DEV ]

bridge monitor [ all | neigh | link ]


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source

Wired to wireless bridge in Linux

You seem to need ip forwarding.

try cat /proc/sys/net/ipv4/ip_forward

If it's 0 issue: echo 1 > /proc/sys/net/ipv4/ip_forward

0
source

IP forwarding on the same network

Ethernet bridging

What you are describing is basically that your RaspPi should be transparent for the network that connect your XBox to your router. Which means that when your XBox request an IP address (it does not have one yet) it will broadcast a message on the network which should reach the router. This bridging between the physical link between your raspPi and XBox to the other link between your RaspPi and router, should be done at ethernet level. So you describes an ethernet bridge, and the bridge utils should be the way to go. Perhaps you could give us more information to spot why your bridge is regularly dropping the connection.

here is an how to do Ethernet bridging on Linux and here is another article on Linux as an Ethernet Bridge.

Configuration

This configuration bridge the Wireless LAN (connected to your internet router) to your XBox. On your RaspPi:

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
auto eth0
allow-hotplug wlan0
auto br0


# The internet network interface
iface eth0 inet static
  address 192.168.2.1
  netmask 255.255.255.0


# The wireless side of the bridge
iface wlan0 inet manual
  wireless-essid MY_ESSID
  wireless-key **********
  wireless-mode master

# The local network bridge
iface br0 inet dhcp
  bridge_ports wlan0 eth0

And on your XBox set the IP address to be manual and 192.168.2.2/255.255.255.0 with the default gateway 192.168.2.1.

More advanced configuration and information here: Bridging with a wireless NIC

IP routing/gateway

At IP level, this is called routing. This technique however is meant to inter-connect to IP networks together, implying that they are not in the same address space. This can be done at iptables level using IP masquerading (aka NAT), and from your question this is not the way you want to go.

This implies that the IP subnet which belongs to your internet router network would be different than the one from your RaspPI/XBox link. You could try to fix an IP that belong from the internet router subnet by manually setting the IP address, and then you would need to set a static route on your internet router so that it is using your RaspPI to reach your XBox. But you need to be able to add those configuration on the internet router and XBox.

You can find a few articles:

0
source

Configure linux machine as bridge/switch and end device

You have two options:

  1. Run the server as a router. In this case, PC1 and PC2 will be located in two different subnets. IP forwarding should be enabled on the server and each NIC will be assigned a different IP.
  2. Bridge the network interfaces of server and in this case the IP is assigned to the bridge interface of server. Also, both PCs will be assigned IPs from same subnet.
0
source

Bridging my laptop's wireless and wired adaptors

I would prefer to get the bridge working under Ubuntu so I'm still searching for answers, but I was able to get the bridge to work on Windows XP.

After bridging the Local Area Connection and the Wireless Network Connection I opened a command prompt and typed the following:

netsh bridge show a

This listed my Local Area Connection with an ID of 1 and my Wireless Network Connection with an ID of 2. The ForceCompatibilityMode of my Wireless Network Connection was shown as Unknown so I typed the following:

netsh bridge set a 2 e

This enabled my Wireless Network Connection. The desktop computer was able to get itself an IP address from the DHCP server on the router. As it turned out, the IP address that it got was the same as the IP address that my Wireless Network Connection usually gets which caused Windows to complain of an IP address conflict on the network. I gave my desktop computer a static IP address and all was well. The desktop computer and the laptop can now both use the Internet.

0
source

How to make network bridge start on boot

Check to make sure the "network" service is enabled. you can use the GUI Services (system-config-services) or chkconfig if you are familiar with that. This solved the same issue for myself.

0
source

XEN dom0 network Bridge has no connection to domU's

I believe this is because you actually need an interface other than a bridge on the Lonux dom0 in order for traffic to actually reach dom0. The bridge is just a bridge, and does not provide an interface into dom0. You can try setting up a dummy interface in dom0 and adding that to the bridge, or perhaps a tap interface. I'm not certain this is what's going on, but it is definitely wor a try.

0
source

Linux Bridge Won't Forward Packets?

Maybe the routes tables need some adjusting.

http://www.cyberciti.biz/faq/linux-route-add/

Every machine needs to

a) know how to reach other machines in the same network

b) know how to reach everythng else (the internet) through a so called "gateway"

As Paul pointed out, the routing tables should have been set correctly because you are using DHCP but you could check.

0
source

VMWare Player: How to set up IP of VM with Network Adapter set to NAT

Take out your static network settings and change the bootproto to DHCP, then reset the network and routing services.

Depends on your distribution, e.g.:

service network restart

/etc/init.d/networking restart (deprecated)

/etc/rc.d/routing restart -- restart routing services, specific to BSD I believe.

Or simply reboot.

0
source

How do I configure routing table to add correct gateway?

eth0 needs to be in promisc mode to pass traffic to the bridge

my setup is physical eth0 in promisc with no ip address, br0 with an dhcp ip and using the bridge as my "interface" for the hardware machine with a route to the gateway from dhcp, then a tap interface added to the bridge and this is used as a "bridged" interface in the virtualization product. does that help?

a tutorial on setting up virtualization with tap interfaces and reachability: http://www.blindhog.net/linux-bridging-for-gns3-lan-communications/

0
source

cablemodem get ip behind bridge

Most likely your ISP will only assign one public IP to your connection. Presence of bridges or other stuff then has nothing to do with it.

0
source

Wireless router can't be found from linux

I solved the problem after installing kismet on the computer and analyzing the results. I found that the routers were set to use channel 13 (it was set to automatic) and an iwlist wlan0 channel reviled that channel 13 was not available. I changed the channel to 1 and now it all works.

0
source

Routing issue with bridged connection

You are really going for the advanced setup here. I'm guessing if you ping your gateway, 192.168.62.1 you get something under 20ms? And pinging 8.8.8.8 (google) gives you 80 sec.

Run a traceroute 8.8.8.8

Your first hop should be quick to 192.168.62.1, second should be to your ISPs Gateway. Traceroute takes longer to complete than a normal ping so don't let that worry you.

If your first 2 hops are different, there could be a network loop, or even a QoS issue.

As for squid, are you running a forward or reverse proxy? Reverse proxy handles requests coming onto a server / network and redirecting them, etc. Forward proxy probably caches external facing requests and logs them, etc.

There is probably no reason why you can't run a proxy on a bridge, but I don't think it's ever done in practice, because a bridge is intended to blindly pass traffic, while a proxy does the opposite.

IPv6 is something you don't want or need at this point. Depending on your ISP and router setup it can provide basically direct (unNATed) access to devices on your network. I don't think it's causing your problem, but if you turn it off it eliminates it as an issue and security risk.

On your debian box, echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.d/disableipv6.conf

I do see a small issue with your routing table. You may have conflicting metrics. Normally, I think your gateway metric should be 0 which it is, but your LAN metric is also 0, I think it should be 1 or more.

I would try changing it. ip route del 192.168.62.0/24 dev br0 proto kernel scope link src 192.168.62.[your ip] metric 0 then ip route add 192.168.62.0/24 dev br0 proto kernel scope link src 192.168.62.[your ip] metric 2

Then try the pings and traceroutes again.

0
source

Strange bridge behaviour, need sugestions

I'd start by investigating the routing table in both hosts, especially in Computer 1:

route -n

Your ARP reply might be getting sent to the wrong interface.

0
source

Make a bridge on my mac

Did you remember to set up, on the Linux machine, routes and DNSs? For the route:

 sudo route add default gw 192.168.3.1

and for the DNSs you will have to edit as sudo the /etc/resolv.conf file, and add:

 nameserver 8.8.4.4
 nameserver 8.8.8.8

or whichever DNS you care to choose.

options

-V, -Version

print the version of the bridge utility and exit.

-s, -stats, -statistics

output more information. If the option appears twice or more, the amount of information increases. As a rule, the information is statistics or some time values.

bridge - command syntax

OBJECT

fdb

- Forwarding Database entry.

COMMAND
Specifies the action to perform on the object. The set of possible actions depends on the object type. As a rule, it is possible to add, delete and show (or list ) objects, but some objects do not allow all of these operations or have some additional commands. The help command is available for all objects. It prints out a list of available commands and argument syntax conventions.

If no command is given, some default command is assumed. Usually it is list or, if the objects of this class cannot be listed, help.

notes

This command uses facilities added in Linux 3.0.

Although the forwarding table is maintained on a per-bridge device basis the bridge device is not part of the syntax. This is a limitation of the underlying netlink neighbour message protocol. When displaying the forwarding table, entries for all bridges are displayed. Add/delete/modify commands determine the underlying bridge device based on the bridge to which the coresponding ethernet device is attached.

bridge fdb - forwarding database management

fdb objects contain known Ethernet addresses on a link.

The corresponding commands display fdb entries, add new entries, and delete old ones.

bridge fdb add - add a new fdb entry
This command creates a new fdb entry.
ADDRESS

the Ethernet MAC address.

dev NAME

the interface to which this address is associated.

local

- the address is associated with a local interface on the system and is never forwarded.

temp - the address is a dynamic entry, and will be removed if not used.

self - the address is associated with a software fdb (default)

embedded - the address is associated with an offloaded fdb

bridge fdb delete - delete a forwarding database entry
This command removes an existing fdb entry.

The arguments are the same as with bridge fdb add,

bridge fdb show - list forwarding entries.
This commands displays current forwarding table.

With the -statistics option, the command becomes verbose. It prints out the last updated and last used time for each entry.

bridge monitor - state monitoring

The bridge utility can monitor the state of devices and addresses continuously. This option has a slightly different format. Namely, the monitor command is the first in the command line and then the object list follows:

bridge monitor [ all | LISTofOBJECTS ]

OBJECT-LIST is the list of object types that we want to monitor. It may contain link, and fdb. If no file argument is given, bridge opens RTNETLINK, listens on it and dumps state changes in the format described in previous sections.

If a file name is given, it does not listen on RTNETLINK, but opens the file containing RTNETLINK messages saved in binary format and dumps them. Such a history file can be generated with the


see also

ip
Please direct bugreports and patches to: <netdev[:at:]vger.kernel[:dot:]org>


author

Original Manpage by Stephen Hemminger

How can this site be more helpful to YOU ?


give  feedback