1.ip設定
ifconfig eth0 128.224.156.81 up //一般的嵌入式linux中設定ip。
ifconfig eth0 128.224.156.81 netmask 255.255.255.0 up
netcfg eth0 up dhcp //通過dhcp 自動獲取ip,閘道器,掩碼等。
2. gateway
route add default gw 128.224.156.1 //一般的嵌入式linux會用這個命令新增閘道器,但是android中不用。直接「netcfg eth0 up dhcp」 自動分配ip等。
3. dns:
echo "nameserver 128.224.160.11" > resolv.conf //一般嵌入式linux中設定dns的方法
nameserver 128.224.160.11
setprop net.dns1 128.224.160.11 //android中設定dns的命令。
setprop net.dns2 147.11.100.30
4、自動獲取ip
# ./dhcpcd -u eth1
broadcast_address='192.168.100.255'
dhcp_lease_time='30'
dhcp_message_type='5'
dhcp_server_identifier='192.168.100.1'
ip_address='192.168.100.10'
network_number='192.168.100.0'
routers='192.168.100.1'
subnet_cidr='24'
subnet_mask='255.255.255.0'
5、自動獲取ip的詳細呼叫過程
# ./dhcpcd -h eth1 -d
dhcpcd[1534]: version 5.6.8 starting
dhcpcd[1534]: eth0: using hwaddr a2:47:2c:1e:af:3b
dhcpcd[1534]: eth0: executing `/home/***/work/android_net/install/libexec/dhcpcd-run-hooks', reason preinit
dhcpcd[1534]: eth0: executing `/home/***/work/android_net/install/libexec/dhcpcd-run-hooks', reason carrier
dhcpcd[1534]: eth1: using hwaddr a2:47:2c:1e:af:3b
dhcpcd[1534]: eth1: executing `/home/***/work/android_net/install/libexec/dhcpcd-run-hooks', reason preinit
dhcpcd[1534]: eth1: executing `/home/***/work/android_net/install/libexec/dhcpcd-run-hooks', reason carrier
dhcpcd[1534]: eth0: sending ipv6 router solicitation
dhcpcd[1534]: eth0: reading lease `/var/db/dhcpcd-eth0.lease'
dhcpcd[1534]: eth0: rebinding lease of 192.168.20.14
dhcpcd[1534]: eth0: sending request (xid 0x425e5b0e), next in 3.62 seconds
dhcpcd[1534]: eth1: sending ipv6 router solicitation
dhcpcd[1534]: eth1: reading lease `/var/db/dhcpcd-eth1.lease'
dhcpcd[1534]: eth1: rebinding lease of 192.168.100.10
dhcpcd[1534]: eth1: sending request (xid 0x18442cad), next in 3.15 seconds
dhcpcd[1534]: eth0: acknowledged 192.168.20.14 from 192.168.3.185
dhcpcd[1534]: eth0: checking for 192.168.20.14
dhcpcd[1534]: eth0: sending arp probe (1 of 3), next in 1.22 seconds
dhcpcd[1534]: eth1: acknowledged 192.168.100.10 from 192.168.100.1
dhcpcd[1534]: eth1: checking for 192.168.100.10
dhcpcd[1534]: eth1: sending arp probe (1 of 3), next in 1.88 seconds
dhcpcd[1534]: eth0: sending arp probe (2 of 3), next in 1.88 seconds
dhcpcd[1534]: eth1: sending arp probe (2 of 3), next in 1.95 seconds
dhcpcd[1534]: eth0: sending arp probe (3 of 3), next in 2.00 seconds
dhcpcd[1534]: eth0: sending ipv6 router solicitation
dhcpcd[1534]: eth1: sending ipv6 router solicitation
dhcpcd[1534]: eth1: sending arp probe (3 of 3), next in 2.00 seconds
dhcpcd[1534]: eth0: leased 192.168.20.14 for 172800 seconds
dhcpcd[1534]: eth0: renew in 86400 seconds, rebind in 86400 seconds
dhcpcd[1534]: eth0: adding ip address 192.168.20.14/24
dhcpcd[1534]: eth0: router 192.168.3.254 requires a host route
dhcpcd[1534]: eth0: adding route to 192.168.20.0/24
dhcpcd[1534]: eth0: adding host route to 192.168.3.254
dhcpcd[1534]: eth0: adding default route via 192.168.3.254
dhcpcd[1534]: eth0: writing lease `/var/db/dhcpcd-eth0.lease'
dhcpcd[1534]: eth0: executing `/home/***/work/android_net/install/libexec/dhcpcd-run-hooks', reason bound
dhcpcd[1534]: forking to background
dhcpcd[1534]: forked to background, child pid 1575
網路常用命令
一,ping 它是用來檢查網路是否通暢或者網路連線速度的命令。作為乙個生活在網路上的管理員或者黑客來說,ping命令是第乙個必須掌握的dos命令,它所利用的原理是這樣的 網路上的機器都有唯一確定的ip位址,我們給目標ip位址傳送乙個資料報,對方就要返回乙個同樣大小的資料報,根據返回的資料報我們可以確...
網路常用命令
一 ping 它是用來檢查網路是否通暢或者網路連線速度的命令。作為乙個生活在網路上的管理員或者黑客來說,ping命令是第乙個必須掌握的dos命令,它所利用的原理是這樣的 網路上的機器都有唯一確定的ip位址,我們給目標ip位址傳送乙個資料報,對方就要返回乙個同樣大小的資料報,根據返回的資料報我們可以確...
網路常用命令
winver 檢查windows版本 wmimgmt.msc 開啟windows管理體系結構 wmi wupdmgr windows更新程式 w指令碼 windows指令碼宿主設定 write 寫字板 winmsd 系統資訊 wiaacmgr 掃瞄器和照相機嚮導 winchat xp自帶區域網聊天 ...