Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm converting my scripts from old net-tools:

ifconfig eth0 192.168.2.1 netmask 255.255.255.0

to iproute2:

ip link set eth0 up
ip addr add 192.168.2.1/24 dev eth0

and I notice that the new commands do not set the broadcast address by default.

What was:

1: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether 1c:6f:65:c5:d6:d7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.1/24 brd 192.168.2.255 scope global eth0

is now:

1: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether 1c:6f:65:c5:d6:d7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.1/24 scope global eth0

I can add the broadcast address to ip addr command, but I wonder if it is needed at all? First of all, how and where is this broadcast address used? What might break if it is not set? Second of all, it looks like the routing table still has the correct entries by default:

# ip route show table local dev eth0 scope link
broadcast 192.168.2.0  proto kernel  src 192.168.2.1 
broadcast 192.168.2.255  proto kernel  src 192.168.2.1 

I cannot even test it because nowadays no one replies to ping -b.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

There is no need to set the broadcast address manually, it is determined automatically from the IP network and subnet mask.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.