日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

linux 静态配置多个ip,linux 配置静态IP

發(fā)布時(shí)間:2025/3/21 linux 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 静态配置多个ip,linux 配置静态IP 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

ip配置方法是編輯sudo nano??/etc/network/interfaces

樹(shù)莓派默認(rèn)配置

auto lo

iface lo inet loopback

iface eth0 inet dhcp

allow-hotplug wlan0

iface wlan0 inet manual

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

修改為靜態(tài)ip的方法

1,老外的方法

sudo vi /etc/network/interfaces

To change to static IP address

cd /etc/networks

sudo nano interfaces

replace the line “iface eth0 inet dhcp” with

iface eth0 inet static

address 192.168.1.4

netmask 255.255.255.0

gateway 192.168.1.1

You should also take a look at the file /etc/resolv.conf

and check it has a nameserver entry (probably pointing at your default gateway) or direct to your ISP name servers.

nameserver 192.168.1.1

2.國(guó)內(nèi)帖子

1.配置ip地址

編輯sudo nano??/etc/network/interfaces

自動(dòng)獲取ip的配置:

auto eth0

allow-hotplug eth0

iface eth0 inet dhcp

手動(dòng)配置ip:

auto eth0

iface eth0 inet static

address 192.168.1.7

netmask 255.255.255.0

gateway 192.168.0.254

2.配置DNS

編輯 sudo nano /etc/resolv.conf

domain lan

search lan

nameserver 192.168.1.1

nameserver 192.168.99.100

注:nameserver 后面的ip就是dns服務(wù)器,根據(jù)自己的運(yùn)營(yíng)商情況填吧

電腦與樹(shù)莓派網(wǎng)線直連

方案1:

on your pc

address 192.168.1.100

netmask 255.255.255.0

gateway 192.168.1.100

on your pi

/etc/network/interface

address 192.168.1.5

netmask 255.255.255.0

gateway 192.168.1.100

方案2:

Rpi

ip 172.16.1.1

mask 255.255.255.0

gateway 172.16.1.2 ?//172.16.1.1 works too

ubuntu

ip 172.16.1.21

sub 255.255.255.0

gateway 172.16.1.1 //172.16.1.10 works too

方案3:

That worked too.

Don't set the devices to be gateway for each other. All you need is something like this:

IP address of PC: 192.168.1.1

IP address of Rasperberry Pi: 192.168.1.2

Subnet mask on both: 255.255.255.0

Default gateway on both: 192.168.1.254

總結(jié)

以上是生活随笔為你收集整理的linux 静态配置多个ip,linux 配置静态IP的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。