Ubuntu下让Linux开发板通过笔记本上网
来源:互联网 发布:linux系统模拟下载 编辑:程序博客网 时间:2024/04/30 23:29
- Configure the LAN and WLAN general description
- Configure the LAN in terminal
- restart the network interface
- Configure WIFI internet access Ethernet share internet access to Dev board
- Why this is important
- Network manager configuration
- Check eth0 configuration
- Configure the LAN and WLAN general description
大多数情况下我们让Linux嵌入式开发板通过LAN口连接笔记本来达到两者之间的通信,这里更进一步,介绍在此基础上,让开发板能共享笔记本的无线网来达到直接上互联网的目的。我使用的开发板是飞凌公司的OK335xD,笔记本操作系统是Ubuntu 12.04。
Configure the LAN and WLAN (general description)
Configure the LAN in terminal
$ sudo nano /etc/network/interfaces
Configure the WLAN to dhcp and automatic and LAN with a static ip address
auto loiface lo inet loopback# The primary network interfaceauto wlan0iface wlan0 inet dhcp# The second eth0auto eth0iface eth0 inet staticaddress 192.168.1.73
restart the network interface
$ sudo /etc/init.d/networking restart
Here if this cannot restart successfully, then try stop/start seperately, and the problem might be:
stop: Unknown instance:networking stop/waiting
and even in the network application in ubuntu, the Wireless configuration is also disabled, it means that at the moment, the /etc/network/interfaces cannot correctly configure the network, here the solution is to use network manager service to configure the network:
sudo nano /etc/NetworkManager/NetworkManager.conf
change the line managed=false to managed=true (normally NetworkManager does not manage interfaces that appear in /etc/network/interfaces), then restart this service:
sudo service network-manager restart
Another method is you can keep managed=false, and just delete all the self-defined configurations in /etc/network/interfaces(keep the first 2 lines for the auto lo), and use the above command to restartd the network manager, because if network manager finds out that there is no configuration in the interfaces file, it will still handle the network configurations even it is set to false.
In Ubuntu, I suggest that we use this method to configure the network, the Network-Manager will make less errors than setting manually on the /e/n/interfaces files, and it can automatically switch when ehternet is connected.
Configure WIFI (internet access) + Ethernet (share internet access to Dev board)
Here I want to keep laptop the internet access to the internet while at the same time, the laptop can also communicate with dev board through ethernet, and also make the dev board have the internet access.
Why this is important ?
My dev board only has ehternet port and runs kernel linux system, so it does not support usb wifi yet, and since the new module needs to be cross compiled through my laptop, so I need the communication between the laptop and dev board (only ehternet works), and I don’t want my laptop lose the internet access because of the ethernet connection. (In Ubuntu 12.04, when it detects that ehternet is connected, it will set the priority of eth0 higher than wlan0), so by default configuration, as soon as laptop has connected with dev board, the internet access is lost.
In windows, I can use the bridge connection mode, in this mode, the eth0 and wlan0 will be set in the same subnet and eth0 shares the internet access of wifi. Ubuntu 12.04 does not support this function by default. If I set manually the eth0 and wlan0 in the same subnet, only one connection (internet wlan0 access or dev board eth0 access) will be available at a time (depends on the value of the metric, you can check the value by typing “ip route show” in terminal).
So to achieve the goal above without using bridge mode, the subnet of wifi and the subnet of ethernet must be different. The easiest way is stil using netwwork manager to configure.
Network manager configuration
- make sure that wlan0 has internet access
- connect the laptop with dev board by ethernet (if necessary restart network manager to make sure that Wired connection is active)
- Open “Network” application -> Options -> Tab IPv4 Settings
- In “Method” list, choose option “Shared to other computers”
- Then click save
- Restart network manager (terminal: sudo service network-manager restart)
Check eth0 configuration
ip route show
Here is the automatically generated eth0 configuration on my laptop
default via 192.168.1.254 dev wlan0 proto static 10.42.0.0/24 dev eth0 proto kernel scope link src 10.42.0.1 metric 1 169.254.0.0/16 dev wlan0 scope link metric 1000 192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.39 metric 2
So the eth0 is assigned to 10.42.0.1, then on the other side, the dev board should set eth0 also in the same subnet and netmask. Here I assigned eth0 in dev board to 10.42.1.75 (here you should find another way to configure the dev board, I used serial port to configure it)
In /etc/network/interfaces in dev board, here is my configuration:
auto loiface lo inet loopbackauto eth0iface eth0 inet staticaddress 10.42.0.75netmask 255.255.255.0gateway 10.42.0.1
Then restart the network interface in dev board
$ sudo /etc/init.d/networking restart
Then it is done. Now laptop can talk to dev board (example: telnet 10.42.0.75), and the dev also have access to the internet, bingo !
huangt@huangt-HP-ProBook-4431s:~$ telnet 10.42.0.75Trying 10.42.0.75...Connected to 10.42.0.75.Escape character is '^]'. _____ _____ _____ _ _ __ _ __ __ | ___| / _ | _ | | | | | | | / / | |__ | | | | | |_| | | | | | | | | / / | __| | | | | | _ / | | | | | | | } { | | | |_| | | | | |___ | | | | | / / |_| _____/ |_| _ |_____| |_| |_| _| /_/ _ ok335x login: rootroot@ok335x:~# ping google.frPING google.fr (173.194.45.79): 56 data bytes64 bytes from 173.194.45.79: seq=0 ttl=51 time=39.767 ms^C--- google.fr ping statistics ---1 packets transmitted, 1 packets received, 0% packet lossround-trip min/avg/max = 39.767/39.767/39.767 msroot@ok335x:~#
- Ubuntu下让Linux开发板通过笔记本上网
- 笔记本Wifi上网通过有线让其它电脑上网
- 手机通过笔记本上网~
- 手机通过笔记本上网
- 台式机通过笔记本上网
- ubuntu 下通过无线网卡建立 AP 让其它无线设备上网
- ipad通过笔记本上网win7
- 开发板通过主机上网
- linux平台下通过nat上网
- 两笔记本通过无线连接共享上网
- Vista笔记本通过神州行手机无线上网
- 两台笔记本通过无线连接共享上网
- ipad通过笔记本上网xp sp3
- 未雨绸缪 笔记本通过手机上网技巧解读
- 两台笔记本通过电信终端上网
- 局域网内PC通过笔记本共享上网
- 台式机通过笔记本的WIFI上网
- linux 学习:ubuntu下PPPoE上网
- **C++**C++刷题笔记
- As新建一个module形式的第三方library
- 快速选择
- 深入理解javascript的作用域--函数声明为什么会前置
- jdk的配置
- Ubuntu下让Linux开发板通过笔记本上网
- UVA - 725(水题)
- 数据结构之二叉树
- 动态SQL与模糊查询
- 使用Hive编写MapReduce程序
- Ubuntu 安装JDK1.8
- Eclipse下配置git方法
- vmware harbor源码编译
- 梳理struts2-执行原理