您的位置:首页 > 移动开发 > Android开发

Ubuntu 12.04 Android 编译搭建全程--(一)ubuntu安装

2013-10-25 13:28 555 查看
=====================================================================

配置:

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)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: