Linux Learning (a): Linux change IP Address command _ Change dns_ change default gateway _ Change Subnet Mask _ host Name

Source: Internet
Author: User

How to use commands to change the IP, DNS, subnet mask of Linux, and add a Linux virtual machine on the virtual machine (Vitrualbox);

Installation method: Http://pan.baidu.com/s/1sjJPhP7


After installation, go to the Linux desktop, a desktop like this:



Press CTRL+ALT+F2 to enter the command line window, then log in and enter it after the login is successful:

VI  /ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETHX

Opens the Settings window, by default, you have only one network card, so you can, if more than one NIC network card may be divided 0, 1 is:

VI  /ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETHX0VI  /etc/sysconfig/network-scripts/ifcfg-ethx1

If it is two network cards, then separate settings on the line;

Open a file that shows this:



Just set the parameters inside the line, such as the note:


Press the "Insert" key on the keyboard to enter the change; When all is configured, press ESC and ENTER: WQ three letters: write Save and exit;

Execute the command again.

VI  /ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETHX

You can see that our changes have been saved.

Then set the virtual Virturalbox-host-only network of the machine, right-click the network in the lower right corner, open the Network Center, you will see this:



Settings, Properties-"ip4-" setting



Here the IP address is preferably the virtual machine inside the gateway set;

After setting up, let's try it and see if we can ping it through:


Can ping the pass, then we set his hostname:

Here, basically the virtual machine system can be used, we can use Remote Tools to connect, we use putty this tool: Putty Chinese version of the download



Then is login, login successful, we enter the command: vi/etc/hosts

Enter the settings and press the "insert" key to set the format of the IP hostname as:



After the change, press ESC, enter: Wq to save and exit, but also to change another place, command: vi/etc/sysconfig/network

Set the host name:


The right side of the equals sign is the hostname you want to set, then press "ESC" and enter: Wq exit;

After exiting does not take effect, enter the command hostname REDHAT1 Press ENTER, and enter Su-can be temporarily changed, as follows:




But it's only temporary, and if you want to change it forever, you need to restart Linux.


Linux Learning (a): Linux change IP Address command _ Change dns_ change default gateway _ Change Subnet Mask _ host Name

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.