A few words of thanks would be greatly appreciated.

Sharing Internet connection using bridge mode

Internet connections can be shared between multiple computers by using the bridge mode of the computer. To activate the bridge mode, a free Ethernet port is required. Individual computers can use this free port to transfer the internet connection from a single box interface. To execute this, the router capabilities of the box should be utilised and activated, so that it can assign unique IPs to the individual computers. Once the PCs and the box are in the same network , the connection sharing process is complete.

An internet connection can be shared with another computer if you have a free Ethernet port

Sharing via bridge mode

When using a box, first activate the router functions of your box so that it can assign a different IP to each PC.

In the image below the PC has two ethernet sockets: eth0 and eth1.
  • eth0 is connected to the Internet and is automatically assigned IP 192.168.0.x by the DHCP
  • eth1 is a free interface (configured with a fixed IP

The /etc/network/interfaces file must look like this:
auto lo      
iface lo inet loopback      

auto eth0      
iface eth0 inet dhcp      

auto eth1      
iface eth1 inet static      

In the next image, a second PC has been connected to the eth1 port.

Making use of the bridge means that any Ethernet frame received on an ethernet interface (eth0 or eth1) will be re-issued on the other. Just like when connecting two PCs using a hub.

PC2 will have its IP address automatically assigned by the box, and can connect directly to the Internet.

Installing bridge-utils

  • Type: sudo apt-get install bridge-utils
  • Change the configuration
  • Modify the /etc/network/interfaces file

auto lo      
iface lo inet loopback      

auto br0      
iface br0 inet dhcp      
bridge_ports eth0 eth1      

auto eth1      
iface eth1 inet static      


  • To validate this configuration, type: sudo /etc/init.d/networking restart
  • The bridge bra is configured to obtain the IP address via DHCP and is then asked to connect "virtually" eth0 and eth1 using the following command: "bridge_ports eth0 eth1"
  • On PC2, you just have to configure it with DHCP (automatic IP address)
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Published by . Latest update on by Virginia Parsons.

This document, titled "Sharing Internet connection using bridge mode," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).