Operating System - Linux
1830045 Members
13869 Online
109998 Solutions
New Discussion

How to change network config from command line?

 
SOLVED
Go to solution
Debbie Fleith
Regular Advisor

How to change network config from command line?

I need to change a Red Hat 7.2 server's ip and router address via a dial-up modem connection. There is only one NIC, eth0.

I thought I could edit /etc/sysconfig/network-scripts/eth0, then restart the network service, but it didn't work.

Are there additional files that need to be edited? Is there some command that would help with this task? (I do not have use of a GUI tool)
4 REPLIES 4
K.C. Chan
Trusted Contributor

Re: How to change network config from command line?

I don't think this is what you want, changing ip's on eth0. If you're dailing to your isp, then eth0 (NIC) has nothing to do with it.

What are you trying to do by changing the dailup's ip address?
Reputation of a thousand years can be determined by the conduct of an hour
Debbie Fleith
Regular Advisor

Re: How to change network config from command line?

This is a new server that I need to configure with a proper IP address for its new network. I do not have access to perform this task at the system console. My only access is dialing into it through a support modem configured and working on the server's comm port.

This task has nothing to do with an isp connection.
K.C. Chan
Trusted Contributor
Solution

Re: How to change network config from command line?

netstat -rn this should give you the interface name

ifconfig eth0 you_ipaddress or ifconfig eth0 netmask eth0 your_ip

/etc/rc.d/init.d/network restart

if you prefer menu driven tried "netconf". Good luck.
Reputation of a thousand years can be determined by the conduct of an hour
W. Michael King
Frequent Advisor

Re: How to change network config from command line?

The config should be stored in:
/etc/sysconfig/network-scripts/ifcfg-eth0

Don't know if your
/etc/sysconfig/network-scripts/eth0
was a typo or not.

Then from the network-scripts directory type:
ifdown eth0
followed by
ifup eth0

and that should do it.
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin, Historical Review of Pennsylvania, 1759