linux 配置靜態IP

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

樹莓派默認配置html

auto lo
iface lo inet loopback
iface eth0 inet dhcp
ubuntu


allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
服務器

修改成靜態ip的方法網絡

1,老外的方法dom

sudo vi /etc/network/interfacesoop


To change to static IP address

cd /etc/networks

sudo nano interfacesthis

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
spa

2.國內帖子server

有些朋友一直在問若是配置網絡,就簡單寫寫吧,但願能幫助到你們
http://bbs.shumeipai.org/thread-158-1-1.html

1.配置ip地址

編輯sudo nano  /etc/network/interfaces

自動獲取ip的配置:

auto eth0  
allow-hotplug eth0    
iface eth0 inet dhcp

手動配置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服務器,根據本身的運營商狀況填吧


電腦與樹莓派網線直連

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=22716

方案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

相關文章
相關標籤/搜索