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 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!

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

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
share|improve this answer
add comment

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.