1 Ubuntu:Bridging Network Interfaces
2 ==================================
3 :author: Aaron Ball
4 :email: nullspoon@iohq.net
5
6
7 == {doctitle}
8
9 I have recently been struggling with configuring an Ubuntu server to allow
10 bridging network interfaces. I had one working long ago on another test
11 machine, but it was overwritten with a new install. That being said, for quite
12 some time today I researched this and never really found an answer. I did
13 however find a few websites that eluded to possible methods for doing this.
14 After piecing said methods together, I managed to bridge four Ethernet ports
15 together.
16
17 All that being said,
18
19
20 [[heres-what-i-needed-to-do...]]
21 == Here's what I needed to do...
22
23 I have four ethernet ports on this awesome quad core xeon processor (hehe...I
24 have to brag a little bit at least) powered server. One port plugs into the
25 switch and provides the box with access to the interwebz. Another port goes to
26 another server, supposing to bring the int3rw3bz to that box as well. The third
27 port goes to a wireless router, providing wireless access to the 1nt3rw3bz.
28
29 Let's see how poor my spelling of 1nt3rw3bz can get by the end of this...
30
31 [[example-assumptions]]
32 === Example Assumptions
33
34 You have at least two network adapters. In this case I have
35 four Ethernet adapters. This post will be working with those four.
36
37
38 [[how-to-do-it]]
39 === How to do It
40
41 Run
42
43 ----
44 sudo apt-get update
45 ----
46
47 to make sure that all of your repositories know of the latest software.
48
49 After that, run
50
51 ----
52 sudo apt-get install bridge-utils
53 ----
54
55 This will install the necessary software to seamlessly bridge network
56 interfaces.
57
58 Now...
59
60 Using your favorite text editor, crack open /etc/network/interfaces
61
62 ----
63 sudo vim /etc/network/interfaces
64 ----
65
66 If you haven't done any manual customization of network interfaces yet, you
67 should see something like...
68
69 ----
70 auto lo iface lo inet loopback
71 ----
72
73 After this entry, type in
74
75 ----
76 auto iface inet dhcp bridge_ports <interface> <interface> <interface>
77 ----
78
79 For my specific situation, I used...
80
81 ----
82 auto br0 (or auto <bridgename>) iface br0 inet dhcp bridge_ports eth3 eth0 eth1 eth2
83 ----
84
85 After that, type
86
87 ----
88 sudo /etc/init.d/networking restart
89 ----
90
91 ... and that will bring online your bridge along with all the bridged ports.
92
93 **If you need your box to have a statically assigned ip address**, don't assign
94 it to the interface with the physical internet connection (in my case, eth3).
95 Instead, assign it to the bridge itself.
96
97 In a situation like mine, your bridge interface would look like...
98
99 ----
100 auto br0
101 iface br0
102 inet static
103 address 10.0.1.185
104 netmask 255.255.255.0
105 network 10.0.1.0
106 broadcast 10.0.1.255
107 gateway 10.0.1.1
108 bridge_ports eth3 eth0 eth1 eth2
109 ----
110
111 There you have it. A network bridge between as many interfaces as you want (or
112 at least the four I tested it with). This of course will work with wireless
113 interfaces as well, such as bridging an ethernet port to a wireless connection,
114 essentially allowing a machine physically connected to a computer with wireless
115 to not have to physically be connected to a wireless router (internet comes in
116 through the wireless card and piped through to the ethernet port).
117
118 Happy bridging everyone!
119
120
121 Category:Linux
122 Category:Ubuntu
123 Category:Networking
124
125
126 // vim: set syntax=asciidoc:
|