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 static ip for ubuntu13.04

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "ubuntu13.04 how to set static ip", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "ubuntu13.04 how to set static ip" bar!

Operating system: Ubuntu13.04

Set up static IP:

Prepare:

1. Check the network card, IP and subnet mask netmask that are in use. Mine is eth0.

The code is as follows:

Ifconfig

Eth0 Link encap:Ethernet HWaddr ec:9a:74:36:c8:8c

Inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0

# IP:192.168.1.100, netmask:255.255.255.0

2. View the gateway gateway

The code is as follows:

Route-n

Destination Gateway Genmask Flags Metric Ref Use Iface

0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

# gateway: 192.168.1.1

# dns: 192.168.1.1 # generally and gateway, of course, you can also set other dns

3. Start setting up static ip now

The code is as follows:

Sudo vim / etc/network/interfaces

# interfaces (5) file used by ifup (8) and ifdown (8)

Auto lo

Iface lo inet loopback

# Set Static IP

Auto eth0 # my network card

Iface eth0 inet static # static, as opposed to dynamic (dhcp, i.e. iface eth0 inet dhcp)

Address 192.168.1.100 # you can set the available ip of the same network segment, such as 192.168.1.102

Gateway 192.168.1.1 # Gateway

Netmask 255.255.255.0 # Subnet Mask

Dns-nameservers 192.168.1.1 # multiple dns can be set or not set here, edit / etc/resolv.conf

Dns-nameservers 114.114.114.114

4. Restart the network card

The code is as follows:

Sudo service networking restart

# or sudo / etc/init.d/networking restart

# if it still doesn't work, restart reboot

# Note:

# when dns-nameservers is not set, it needs to be manually added in / etc/resolv.conf

Sudo vim / etc/resolv.cof

Nameserver 192.168.1.1

In addition:

In relatively earlier versions, you need to set up the resolv.conf file under / etc and add nameserver so that you can connect to the Internet, otherwise you can only access it through ip and cannot resolve the URL. (nslookup can see the URL ip, of course, you must first have dns).

After Ubuntu12.04, this approach is no longer recommended because no matter what value you want to set in the configuration file, the restart will be restored to the original state. (does not include the automatic setting of the boot script, of course)

The recommended practice is to add the line dns-nameservers directly to the interfaces configuration file.

Thank you for reading, the above is the content of "how to set static ip in ubuntu13.04". After the study of this article, I believe you have a deeper understanding of how to set static ip in ubuntu13.04, 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.

Share To

Servers

Wechat

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

12
Report