Linux Modify IP Restart network card method __linux

Source: Internet
Author: User

To modify the network card command:

Ifconfig eth0 192.168.0.3 netmask 255.255.255.0
⚠️ temporarily modify IP effective, if you want to restart after still effective, you can modify the network card configuration file.

To reboot the network card command:

CentOS: sudo service network restart
Ubuntu: sudo/etc/init.d/networking restart

NIC configuration file: CentOS: Modifying/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0      #网卡对应的设备别名
bootproto=static #网卡获得ip地址的方式 (defaults to DHCP for automatic acquisition)
HWADDR=00:07:E9:05:E8:B4        # Nic MAC address (Physical address)
ipaddr=192.168.100.100          #IP地址
netmask=255.255.255.0           #子网掩码 
onboot=yes                      #系统启动时是否激活此设备
Ubuntu: Modify/etc/network/interfaces
Auto eth0
iface eth0 inet static address
192.168.3.90
Gateway 192.168.3.1
netmask 255.255.255.0

Modify DNS

# vi/etc/resolv.conf
nameserver 8.8.8.8              #google域名服务器
nameserver 114.144.114.114      #国内域名服务器

Ubuntu Reference: http://www.linuxidc.com/Linux/2013-04/83577.htm
CentOS Reference: http://www.linuxidc.com/Linux/2015-02/112964.htm

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.