1

I'm trying to configure the ip address, broadcast and subnet mask of a series of interfaces. However, I'd like to configure the IP Address independent of the broadcast address and vice versa. In other words, when I use the command

ifconfig eth5 192.168.10.101

The broadcast address is updated to 192.168.10.255. When I update the broadcast address the ip is also updated accordingly.

How can I change one without automatically modifying the other?

Additionally, I was wondering if the best way to make permanent changes to the IP Address, Broadcast, and so on is through editing the /etc/sysconfig/network-scripts file on redhat linux. Thanks!

synchronicity
  • 85
  • 1
  • 2
  • 7

3 Answers3

4

Have a look at How Does Subnetting Work?

I am assuming you are using a /24 (255.255.255.0) subnet mask which is why it is automatically changing your broadcast to 192.168.10.255. There are only 254 (256 - 2) usable addresses in a /24 going from

192.168.10.0 - 192.168.10.255 

with 192.168.10.0 being your network address and 192.168.10.255 your broadcast address (hence why it changes). In order to change your broadcast address you need to subnet your network.

As for automatically configuring your NIC, if you are on a RedHat based Linux distro you can edit the file:

/etc/sysconfig/network-scripts/ifcfg-<interface name>

Debian based distros use the following file:

/etc/network/interfaces

Do a

man interfaces

on a Debian distro for documentation on that file.

Gentoo uses

/etc/conf.d/net

Arch Linux uses

/etc/rc.conf
smoak
  • 646
  • 2
  • 7
  • 13
1

You can use following from command line

ifconfig eth5 192.168.10.101 netmask YOURS broadcast YOURS

But as you mentioned only proper way for permanent change is /etc/sysconfig/network-scripts for details and list of options see RH docs.

0

You might want to look at the iproute2 stuff - it's recommended now over ifconfig. You could do something like:-

ip addr replace 192.168.0.1 broadcast 255.255.255.0 dev eth1
Andy Smith
  • 1,798
  • 13
  • 15