Linux command line set IP, gateway and Dns__linux

Source: Internet
Author: User
Linux command line set IP, gateway, and DNS
IP and Subnet Masks execute this command: ifconfig eth0 192.168.1.123 netmask 255.255.255.0

Write these two commands in/etc/rc.local or/etc/rc.d/rc.local, so you can keep them permanently.

/etc/sysconfig/network Set the default gateway, host name, whether to start the network 3 items;
/ETC/SYSCONFIG/NETWORK-SCRIPT/IFCFG-ETHN, n indicates the network card number, this place can set the parameter of the network card,
such as Ip,netmask,network,broadcast,gateway, the power to obtain IP protocol mode (dhcp,static) static,
Whether to start on the boot and so on,
/etc/resolv.conf Configure DNS servers
/etc/hosts the machine name and IP address in the LAN to achieve the purpose of accessing other machines through the machine name (only in the
Machine name cannot be checked against IP case)

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.