Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Mar 3 '13 at 16:37

This question came from our site for professional and enthusiast programmers.

2 Answers 2

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.

share|improve this answer

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|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.