Ubuntu是私有标准桌面化Linux系统,是大家在租用香港服务器时使用的操作系统之一。近日有网友咨询香港服务器Ubuntu如何配置单个IP与整段IP,本文就为大家介绍下操作步骤,仅供大家参考。

序列号 CPU RAM HDD 带宽 售价(美元) 免费试用
香港服务器1 E5-2620 32G 1T HDD 50M/无限流量 $196.00 立即申请
香港服务器2 E5-2650 32G 1T HDD 50M/无限流量 $256.00 立即申请
香港服务器3 E5-2680 32G 1T HDD 50M/无限流量 $316.00 立即申请
香港服务器4 E5-2690 32G 1T HDD 50M/无限流量 $336.00 立即申请
香港服务器5 E5-2697 32G 1T HDD 50M/无限流量 $376.00 立即申请
香港服务器6 E5-2620*2 32G 1T HDD 50M/无限流量 $376.00 立即申请
香港服务器7 E5-2650*2 32G 1T HDD 50M/无限流量 $436.00 立即申请
香港服务器8 E5-2680*2 32G 1T HDD 50M/无限流量 $476.00 立即申请
香港服务器9 E5-2690*2 32G 1T HDD 50M/无限流量 $556.00 立即申请
香港服务器10 E5-2697*2 32G 1T HDD 50M/无限流量 $596.00 立即申请
香港服务器11 E5-2680v4*2 32G 1T HDD 50M/无限流量 $696.00 立即申请
香港服务器12 E5-2698v4*2 32G 1T HDD 50M/无限流量 $796.00 立即申请

一、多IP不同段配置方法:

多个不同IP段的 /etc/network/interfaces 配置文件的范例如下:

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet static

address 8.8.8.2

netmask 255.255.255.248

gateway 8.8.8.1 (如果是多个不同IP段,只要1个gateway配置就行,其它IP不需要配置gateway)

auto eth0:0

iface eth0:0 inet static

address 8.8.8.3

netmask 255.255.255.248

auto eth0:1

iface eth0:1 inet static

address 8.8.8.4

netmask 255.255.255.248

auto eth0:2

iface eth0:2 inet static

address 8.8.8.5

netmask 255.255.255.248

auto eth0:3

iface eth0:3 inet static

address 8.8.8.6

netmask 255.255.255.248

auto eth0:4

iface eth0:4 inet static

address 6.6.6.130(虽然这是不同的IP段,但不需要配置gateway,只需配置netmask即可)

netmask 255.255.255.224

auto eth0:5

iface eth0:5 inet static

address 6.6.6.131

netmask 255.255.255.224

如果想添加更多独立IP的话,按照上述方法进行添加就行了。

配置文件完成后,用命令/etc/init.d/networking restart 重启网络,不需要reboot重启服器。/etc/init.d/networking restart重启网络的时候,如果你的配置文件有错误,一般都有提示的。

二、整段IP添加方法

整段IP添加使用脚本添加,具体如下:

# !/bin/bash

for ((i=10;i

do

echo “auto eth0:$i”>>/etc/network/interfaces

echo “iface eth0:$i inet static”>>/etc/network/interfaces

# let j=$i

echo “address 193.10.10.$j”>>/etc/network/interfaces

echo “netmask 255.255.255.0”>>/etc/network/interfaces

echo “gateway 193.10.10.254″>>/etc/network/interfaces

Tag: 重启配置文件多个不需要香港

标题:香港服务器Ubuntu配置单个IP与整段IP教程

地址: https://www.irqm.com/353.html