Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up network connection in Ubuntu

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to set up a network connection in Ubuntu, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.

Solution:

1. Configure IP and other related Ubuntu network settings

Sudo vi / etc/network/interfaces

Auto lo

Iface lo inet loopback

# the above 2 lines are system loopback devices, which must have

Auto eth0

Iface eth0 inet static

Address 192.168.0.2

Netmask 255.255.255.0

After installing the system, Ubuntu network settings connection found that the original Ubuntu 8.10 (Intrepid Ibex) really can not save the Ubuntu network settings, reboot is equivalent to no settings, I do not know what the problem, I am a local area network. I solved this by removing the Auto eth0 from the wired connection and then manually adding a new connection so that the settings can be saved.

Check Ubuntu network settings

$ifconfig

Configure the DHCP client

$sudo vi / etc/network/interfaces

Join iface eth0 inet dhcp

Ubuntu network settings configure static IP addresses

$sudo vi / etc/network/interfaces

The eth0 configuration is as follows:

Auto eth0

Address 192.168.0.88

Netmask 255.255.255.0

Gateway 192.168.0.1

Let the new configuration take effect

After saving and exiting, use the restart networking command to make the new configuration take effect:

$sudo / etc/init.d/networking restart

You can also restart the Nic to allow the new configuration to take effect. The advantage is that it does not affect other network interfaces:

$sudo ifdown eth0

$sudo ifup eth0

Temporarily change the IP address

$sudo ifconfig eth0 192.168.1.111 netmask 255.255.255.0

When the system reboots, the configuration in interfaces is restored later.

There are also two ways to set the default gateway:

1. Set in the interfaces file.

$sudo vi / etc/network/interfaces

Add gateway under the relevant configuration of eth0, such as:

Auto eth0

Iface eth0 inet static

Address 192.168.1.123

Netmask 255.255.255.0

Gateway 192.168.1.1

two。 Set it directly with the command:

Delete the current default gateway

$sudo route del default gw

Manually configure the default gateway

$sudo route add default gw 192.168.1.1

View routing information

$route

Using this method, the modification takes effect immediately, and after restarting, the settings in the interfaces file are valid.

View hostname

$hosts

Temporarily modify the hostname

$sudo hostname testserver

Effective immediately after the execution of the order.

* modify hostname

$sudo vi / etc/hostname

Just write the new hostname. When the system restarts, the hostname in this file is read.

Ubuntu network settings configure the address of the DNS server. You can use up to 3 DNS servers.

$sudo vi / etc/resolv.conf

Nameserver 202.xx.xx.xx

Nameserver 192.168.1.1

The changes to "resolv.conf" are effective immediately. You can use the nslookup command to query the DNS server to verify the "resolv.conf" configuration file.

On how to set up the network connection in Ubuntu to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report