設定靜態ip

2021-08-20 06:31:02 字數 1331 閱讀 3289

一、流程:

1、物理橋接——>dns 設定-->閘道器設定-->網絡卡設定-->重啟服務

二、具體步驟:

1、我們的電腦可以用橋接(進行物理直連)

2、vim /etc/resolv.conf

# generated by networkmanager

# no nameservers found; try putting dns servers into your

# ifcfg files in /etc/sysconfig/network-scripts like so:

## dns1=***.***.***.***

# dns2=***.***.***.***

# domain=

lab.foo.com

bar.foo.com

nameserver 114.114.114.114

3、vim /etc/sysconfig/network

# created by anaconda

gateway=192.168.50.1

#gateway:為閘道器的ip位址(也就是閘道器)

4、vi  /etc/sysconfig/network-scripts/ifcfg-eno16777736            //配置->系統配置->網路指令碼->網絡卡配置檔案

type=ethernet

bootproto=static                                //設定為靜態

defroute=yes

ipv4_failure_fatal=no

ipv6init=yes

ipv6_autoconf=yes

ipv6_defroute=yes

ipv6_failure_fatal=no

name=eno16777736

uuid=abef92ca-0aba-4f25-beb0-e1c85ed6312a

device=eno16777736

onboot=yes

peerdns=yes

peerroutes=yes

ipv6_peerdns=yes

ipv6_peerroutes=yes

ipaddr=192.168.50.30                //填加ip

netmask=255.255.255.0            //子網掩碼

注釋:networking:用於設定linux網路是否執行,yes為執行,no為不執行

hostname:主機的名稱,我們上面的名稱為duzhan

nameserver   #定義dns伺服器的ip位址

設定靜態IP

1,遠端主機靜態ip繫結。為遠端主機在區域網中繫結乙個固定的ip位址,方便ssh連線。設定開機自啟動,ubuntu 18.04沒有rc.local。需要自己生成這個檔案,並且加入啟動指令碼中。設定rc.local自啟 執行sudo gedit etc systemd system rc local....

ubuntu server 設定靜態ip

修改這個網路配置檔案,預設一般是自動獲得ip的。sudo vi etc network inte ces 檔案內容 auto lo iface lo inet loopback script grep map eth0 auto eth0 iface eth0 inet static address...

ubuntu設定靜態ip

ubuntu10.04設定靜態ip 2010 12 20 09 39 step1 設定ip vi etc network inte ces 檔案內容修改為 auto eth0 iface eth0 inet static address 192.168.1.2 gateway 192.168.1.1...