Difference between revisions of "Linux/Network/Change ip"
(Tag: VisualEditor) |
|||
(One intermediate revision by the same user not shown) | |||
Line 14: | Line 14: | ||
Centos 7: | Centos 7: | ||
systemctl restart network | systemctl restart network | ||
− | Now the network can be connected and ssh used to operate the server. | + | Now the network cable can be connected and ssh used to operate the server. |
+ | [[Category:Linux]] | ||
+ | [[Category:Network]] |
Latest revision as of 12:27, 5 June 2015
If a server is moved to another network, the static ip often needs to be modified. This must be done before connecting the network cable, with hardware monitor and keyboard. First find out which ip range is used by dhcp and choose an unused address outside the dhcp range. Then edit the ifcfg file, which is often called ifcfg-eth0, but sometimes it has a different name. Then it is the one that is not called ifcfg-lo.
vi /etc/sysconfig/network-scripts/ifcfg-eth0In that file you will find several lines containing ip adresses. They must be changed to fit the new network.
After saving the changes the network needs to be restarted.IPADDR="The ip outside the dhcp range"
NETWORK="The ipaddr with a 0 on the fourth position"
GATEWAY="The ip of the router to the internet"
DNS1="The ip of the first dns server"
DNS2="The ip of the second dns server"
SEARCH="The workgroup name of smb servers in your network"
Centos 6:
/etc/init.d/network restart
Centos 7:
systemctl restart network
Now the network cable can be connected and ssh used to operate the server.