In Linux, how can I modify the IP address information is always changed using ifconfig, and always had to be redone after restart. If you modify the configuration file, you don't have to worry about it ~ A. The IP address modification takes effect immediately: www.2cto.com # ifconfigeth0192.168.0.20netmask255.2... how can I modify the IP address information in Linux? I always use ifconfig to modify the IP address information. I always have to redo it after restart. If you modify the configuration file, you don't have to worry about it ~ A, modify the IP address effective immediately: www.2cto.com # ifconfig eth0 192.168.0.20 netmask 255.255.255.0 start effective: modify/etc/sysconfig/network-scripts/ifcfg-eth0 B, modify the default gateway effective immediately: # route add default gw 192.168.0.254 start effective: modify/etc/sysconfig/network-scripts/ifcfg-eth0 C, modify dns modify/etc/resolv. after the conf file is modified, the change takes effect immediately. D. The change to host name www.2cto.com takes effect immediately: # hostname fc2 takes effect immediately: modify/etc/sysconfig/network to start the network configuration/etc/init. d/network restart Premise: Redhat system ip address, mask: edit/etc/sysconfig/network-script/ifcfg-eth0IPADDR = 192.168.0.1NETMASK = 255.255.255.0 Gateway: edit/etc/sysconfig/networkNETWORKING = yesHOSTNAME = xxGATEWAY = 192.168.0.100DNS: edit/etc/resolv. confNAMESERVER = 202.96.209.5 note: The above IP addresses must be changed to the IP address corresponding to your network configuration. In Linux, it is recommended to modify the IP address vi/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0BOOTPROTO = noneBROADCAST = 192.168.1.255IPADDR = 192.168.1.33NETMASK = 255.255.255.0NETWORK = 192.168.1.0ONBOOT = yesUSERCTL = noPEERDNS = noTYPE = Ethernet ~ Vi/etc/sysconfig/network-scripts/ifcfg-eth1DEVICE = eth1 unzip ONBOOT = yesBOOTPROTO = noneIPADDR = Mirror = 255.255.255.0USERCTL = noPEERDNS = noTYPE = EthernetNETWORK = 192.168.2.0BROADCAST = 192.168.2.255 two modify gateway vi/etc/ sysconfig/networkNETWORKING = yesHOSTNAME = onongateway = 192.168.1.1 3 restart network configuration/etc/init. d/network restart ------------------------ modify the configuration file/etc/sysconfig/network-scripts/under the configuration file such as File: ifcfg-eth0 represents the actual Ethernet NIC 0 configuration file such as File: ifcfg-eth0: 1 indicates the configuration file of the actual Ethernet NIC 0. domain name server configuration file:/etc/resolv. conf modify IP address effective immediately: www.2cto.com # ifconfig eth0 192.168.0.20 netmask 255.255.255.0 start effective: modify/etc/sysconfig/network-scripts/ifcfg-eth0 modify default gateway effective immediately: # route add default gw 192.168.0.254 start effective: modify/etc/sysconfig/network-scripts/ifcfg-eth0 modify dns modify/etc/resolv. the change of conf takes effect immediately. The change of host name takes effect immediately after startup: # hostname fc2 takes effect immediately after startup: modify/etc/sysconfig/network
Author: newhappy2008
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service