How to set BROADCAST address with NetworkManager
Issue
- How to set
BROADCAST
address with NetworkManager. Though RHEL6 and 7 initscripts and RHEL8 network-scripts provide BROADCAST variable, NetworkManager doesn't provide it.
RHEL6 Deployment Guide / 11.2.1. Ethernet Interfaces
BROADCAST=address
where address is the broadcast address. This directive is deprecated, as the value is calculated automatically with ipcalc.
Sample ifcfg-enp7s0 for enp7s0 interface with network-scripts:
yum install -y network-scripts
cat << 'EOF' > /etc/sysconfig/network-scripts/ifcfg-enp7s0
DEVICE=enp7s0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=172.16.1.71
BROADCAST=172.16.255.255
USERCTL=no
IPV6INIT=no
IPV6_AUTOCONF=no
NM_CONTROLLED=no
EOF
ifup enp7s0
[root@host /]# ip addr list dev enp7s0
3: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:4e:63:49 brd ff:ff:ff:ff:ff:ff
inet 172.16.1.71/24 brd 172.16.255.255 scope global enp7s0
valid_lft forever preferred_lft forever
[root@host /]#
172.16.255.255 is called all-subnets directed broadcasts and is needed in some networking environments.
Environment
- Red Hat Enterprise Linux 7, 8, 9
- NetworkManager
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.