Linux Modify IP Address

Source: Internet
Author: User
Tags solr zookeeper nameserver

The next system was reinstalled yesterday and found that the Linux system IP addresses installed in the virtual machine were reassigned and did not start to feel anything, but the plan to connect the SOLR cluster in the virtual machine was found to be tragic because of the SOLR cluster that was built using zookeeper, In the Zookeeper configuration file, the IP address set is completely different from the current system, although it can be changed manually. But still feel too troublesome, finally decided to directly modify the IP address of Linux, the following is the method of modification.

Note: The modification must use root permission, otherwise it cannot be modified successfully.

1. before starting the operation, enter the command ifconfig to view the NIC name in the command line as shown in

As shown in, you can see two network adapter names: Ens33 and lo. And all we need to do is fix the NIC that changed to ENS33.

Note: Here is a pit, if the NIC name shown here before Ubuntu 16.04 is enth0, instead of the ens33now displayed.

Find a picture on the Internet, the network card name does not have the same name as the network card now

2. Enter vim/etc/network/interfaces at the command line, use the editor to open the interfaces configuration file, and enter the following code.

1 # Interfaces (5) file used by Ifup (8) and Ifdown (8)2 Auto Lo3 iface Lo inet loopback4 5 Auto ens33 6 iface ens33 inet static7 Address 192.168.1.78 netmask 255.255.255.09 Gateway 192.168.1.1Ten dns-nameservers 218.85.157.99 218.85.152.99

Set the NIC name to ENS33 static IP address, gateway, DNS address, etc. Note that the NIC name here needs to be modified according to your own NIC name. If you change the NIC name Ens33 to eth0, the following error will occur

[....] Restarting networking (via Systemctl): Networking.servicejob for Networking.service failed because the control process Exi Ted with error code.

See "Systemctl Status Networking.service" and "Journalctl-xe" for details. failed!

As shown in the following changes

3. Set the DNS service address

The DNS address has been set up in the second step, and here's the place to look.

  1. View the DNS address you can enter Ipconfig/all to view the DNS service address in the Windown command window.

2. do not manually set the nameserver in the profile /etc/resolv.conf , otherwise all DNS addresses will be overwritten after the system is restarted. So if you want to set the DNS service address, in the second step of the configuration file interfaces set the Dns-nameservers property, each DNS service address with a space interval, after re-network service, all nameserver will be added to the/etc/ The resolv.conf configuration file.

The following is the DNS service address after /etc/resolv.conf restarts the network

4. After the setup is complete, enter the command /etc/init.d/networking restart Restart the network

See OK to restart the success, continue to view the current network card through the ifconfig command situation

You can see that the IP address has been modified successfully. My previous address was 192.168.1.6.

Note: If the boot is unsuccessful or an error occurs. Enter systemctl restart Network-manager.service on the command line to restart the network service

The process of modifying the IP is simple, but the process of modification needs to pay attention to the network card name and DNS service settings, do not step on the pit.

There are a lot of shortcomings in the article, welcome to correct them. Thank you!

Linux Modify IP Address

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.