Ubuntu 12.04 Android 編譯搭建全程--(一)ubuntu安裝

 =====================================================================

配置:

lenovo

product: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
64 bits
4G內存

======================================================================

原先是WIN8系統,使用 Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-generic x86_64)鏡像安裝。

安裝完系統後開機後ubnutu無法聯網,在終端中#:ifconfig後,

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet6 addr: fe80::d63d:7eff:fec8:bf7b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3406 errors:0 dropped:0 overruns:0 frame:0
          TX packets:378 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:478898 (478.8 KB)  TX bytes:61014 (61.0 KB)
          Interrupt:43 Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

說明一下公司網絡環境

統一自動分配IP。爲什麼重裝系統後會無法正常聯網呢。

Q1: 網卡驅動安裝不正常?

A1:可以排除
通過lshw查看硬件信息

joe@ubuntu:~$ lshw -c net
WARNING: you should run this program as super-user.
  *-network               
       description: Ethernet interface
       product: RTL8111/8168B PCI Express Gigabit Ethernet controller

而且ifconfig也是有eth0的,所以不可能是這個問題。

Q2:網絡通路查看

A2:

ping 127.0.0.1

ping 127.0.0.1 正常

ping同網段的主機

ping 172.16.148.1

提示:connect: network is unreachable

網絡不通

 

最後找到的解決方法


Com a rede já pronta, agora vamos efetuar o compartilhamento da Internet.

Agora vamos habilitar o encaminhamento de IPv4.

原來公司這邊使用的IP自動分配爲IPV4的IP,而Ubuntu 12.04 server 默認的話是IPV6

所以只要修改ipv6爲IPV4
 
$ sudo vim /etc/sysctl.conf
修改
# net.ipv4.ip_forward=1 
爲  
 net.ipv4.ip_forward=1

當然因爲公司的網絡管理是自動獲取IP不允許綁定IP,一個端口自動獲取完就與mac綁定了。如果是使用固定的靜態IP配置應該不出現這個問題。
 
 
eth0      Link encap:Ethernet  HWaddr xxxxxxxxx
          inet addr:172.16.148.107  Bcast:172.16.148.255  Mask:255.255.255.0
          inet6 addr: fe80::d63d:7eff:fec8:bf7b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:449 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:730904 (730.9 KB)  TX bytes:70328 (70.3 KB)
          Interrupt:43 Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章