In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the method of setting IP and gateway in ubuntu". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to set up IP and gateway in ubuntu".
If you are using Ubuntu in a virtual machine, please refer to my previous article on how to set the network settings in the connection extranet by referring to the Net method of the virtual machine. Set up the network of the host, and then configure the IP and gateway of the virtual machine Ubuntu.
If the host operating system is Ubuntu, please refer to the following
The contents are as follows:
1. To verify that you can connect, use the ping command to ping the gateway
It's always realistic at the beginning, unreachable.
two。 Set up IP
Sudo ifconfig eth0 133.133.133.190 netmask 255.255.255.0
In this way, the IP address and subnet mask of the network card eth0 are set.
3. Set the gateway sudo route add default gw 133.133.133.40
4. Ping gateway can be connected with ping.
5. Set DNS modification / etc/resolv.conf to add to it
Address 1 of nameserver DNS
Address 2 of nameserver DNS
Done.
After this setting, it seems that the IP will change again the next time it is turned on.
Permanently modify Ubuntu LINUX IP
Use the command to set the ip address of ubuntu
1. Set IP sudo ifconfig eth0 203.171.239.155 netmask 255.255.255.224 so that even if the IP address and subnet mask of the network card eth0 are set
two。 Set the gateway sudo route add default gw 203.171.239.129
3. Set DNS to modify / etc/resolv.conf, and address 2 of the address 1 nameserver DNS that is added to the nameserver DNS is completed. However, after this setting, it seems that IP will no longer exist the next time it is turned on.
Second, directly modify the system configuration file ubuntu network configuration file is: / etc/network/interfaces open inside can be set DHCP or manually set static ip. Front auto eth0, let the network card boot and mount automatically.
1. Configure the network card edit file in DHCP mode, switch to / etc/network/interfaces: specify the following command, sudo vi / etc/network/interfaces
And replace the line about eth0 with the following line:
# The primary network interface-use DHCP to find our address
Auto eth0 iface
Eth0 inet dhcp
Use the following command to make the network settings effective: sudo / etc/init.d/networking restart
You can also enter the following command directly from the command line to get the address sudo dhclient eth0
two。 Configure static IP address editing file for network card
/ etc/network/interfaces: sudo vi / etc/network/interfaces
And replace the line about eth0 with the following line:
# The primary network interface
Auto eth0
Iface eth0 inet static
Address 203.171.239.155
Gateway 203.171.239.129
Netmask 255.255.255.224
# network 203.171.239.128 # broadcast 192.168.3.159
Change the above ip address and other information to yourself. Use the following command to make the network settings effective: sudo / etc/init.d/networking restart
3. Set the second IP address (virtual IP address) to edit the file
/ etc/network/interfaces: sudo vi / etc/network/interfaces
Add the following line to the file:
Auto eth0:1 iface eth0:1 inet static address 192.168.1.155 netmask 255.255.255.0 work x.x.x.x broadcast x.x.x.x gateway x.x.x.x fill in all information such as address,netmask,network,broadcast and gateways according to your situation. Use the following command to make the network settings effective: sudo / etc/init.d/networking restart
4. Set host name (hostname) use the following command to view the host name of the current host: sudo / bin/hostname uses the following command to set the host name of the current host: when the sudo / bin/hostname newname system starts, it reads the host name from / etc/hostname. 5. To configure DNS, first of all, you can add some host names and IP addresses corresponding to these host names in / etc/hosts, which is a simple local static query. To access the DNS server for query, you need to set up the / etc/resolv.conf file. Suppose the IP address of the DNS server is 203.171.230.6. The content of the resolv.conf file should be: search test.com nameserver 203.171.230.6 restart the network: / etc/init.d/networking restart
PS: according to the above method, install Ubuntu in the virtual machine VMware, set the virtual machine network connection method to Net, and set the static IP connection network. I have passed the test. Directly modifying resolv.con and interfaces can ensure that the set IP still exists after boot.
Thank you for your reading. the above is the content of "how to set up IP and gateway in ubuntu". After the study of this article, I believe you have a deeper understanding of the method of setting up IP and gateway in ubuntu, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.