Assigning IP to a bridged interfaces

18,825

Solution 1

You can directly assign a new IP address to your bridge:

ip addr add 192.168.0.2/24 brd + dev br0

You also may need to configure a route for the internet connection:

route add default gw 192.168.0.1 dev br0

Note: replace the provided IP address in the above examples by the proper one for your subnet.

Solution 2

An interface that is a member of a bridge cannot have IPs assigned to it directly. You assign an address to the bridge interface instead, e.g.

ifconfig br0 0.0.0.0
Share:
18,825

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    Is there a way to assign an IP to bridged interfaces? For example, under normal circumstances:

    ifconfig eth0 0.0.0.0
    ifconfig eth1 0.0.0.0
    brctl addbr mybridge
    brctl addif mybridge eth0
    brctl addif mybridge eth1
    

    So is there a way to either:

    • (a) assign IPs to eth0/eth1?
    • (b) if not, then is there any other way around this problem?

    I want to some how bridge interfaces having IPs.