beaglebone-black 在Angstrom系统中的网络配置方法
2013-09-11 20:22
615 查看
Beaglebone Linux 101: Assigning a Static IP Address with Connman
Posted on February 6, 2012 by dwattsMy article on configuring Angstrom Linux included instructions for setting a static IP address. Sometime after posting that article, I realized that the instructions work great unless you happen to reboot. Then, the settings reverted to the default of using a DHCP server.
Ooops!
It turns out that this sleight-of-hand is the work, aptly enough, of a package namedConnman.
This newfangled connection manager is, in some ways, a good fit for the Beaglebone, since it was designed to run on memory-constrained embedded Linux systems. It was originally developed for use on 2 Linux platforms that have struggled, Meego and Moblin, but we won’t hold that against it.
However, Connman presents one big problem for Beaglebone users: it’s rather difficult to configure from the command line.
It doesn’t come with a command line configuration tool, but it does provide some well documented APIs that command line applications can use. As such, the best command line interface right now can be found in a package intended to test that the APIs are working correctly: connman-tests.
To install the package:
opkg install connman-tests
This will install a set of Python scripts in /usr/lib/connman/test.
To check your current configuration:
cd /usr/lib/connman/test/ ./get-services
The output should look like the following:
[ /net/connman/service/ethernet_405fc276b749_cable ] IPv6.Configuration = { Method=auto Privacy=disabled } AutoConnect = false Proxy.Configuration = { } Name = Wired Nameservers = [ 206.47.244.104 206.47.199.155 ] Provider = { } Favorite = true Domains.Configuration = [ ] State = online Proxy = { Method=direct } Nameservers.Configuration = [ ] LoginRequired = 0 IPv6 = { } Domains = [ lan ] Ethernet = { Interface=eth0 MTU=1500 Method=auto Address=xx:xx:xx:xx:xx:xx } Security = [ ] IPv4.Configuration = { Method=dhcp } Type = ethernet Immutable = false IPv4 = { Netmask=255.255.255.0 Gateway=192.168.1.1 Method=dhcp Address=192.168.1.161 }
The important thing to note here is the service ID at the top of the output, in my case ethernet_405fc276b749_cable. (Dumb name for an ethernet cable, if you ask me.)
You can also get the DNS nameserver and gateway IP addresses from this output, if you don’t already know them.
To change the configuration, you use 2 other scripts, set-ipv4-method and set-nameservers.
The syntax for set-ipv4-method is:
./set-ipv4-method <service> [off|dhcp|manual <address> [netmask] [gateway]]
The service parm is that long string that appears at the top of the output from the get-services script.
So, to set the Beaglebone to use a static IP address of 192.168.1.2, with a gateway of 192.168.1.1, I entered:
./set-ipv4-method ethernet_405fc276b749_cable manual 192.168.1.2 255.255.255.0 192.168.1.1
To set the DNS nameservers, use set-nameservers. The syntax is:
./set-nameservers <service> [nameserver*]
In my case, I entered
./set-nameservers ethernet_405fc276b749_cable 206.47.244.104 206.47.199.155
That’s it: after entering those 2 commands, you’ll be running with the new network settings, no reboot required. (Though, if you plan to blog about it, a reboot is definitely recommended!)
相关文章推荐
- Linux下NFS(网络文件系统)的建立与配置方法
- Linux系统下NIS(network information service)网络信息服务器配置方法------RHEL4
- Linux下NFS(网络文件系统)的建立与配置方法
- Linux下NFS(网络文件系统)的建立与配置方法 [转]
- Win8.1系统下VirtualBox的各种网络配置方法——Not attached(未指定)
- Linux下NFS(网络文件系统)的安装与配置方法
- Linux下NFS(网络文件系统)的建立与配置方法
- Win8.1系统下VirtualBox的各种网络配置方法——NAT Network
- Linux下NFS(网络文件系统)的建立与配置方法
- VirtualBox中运行Android X86系统的网络配置方法
- Win8.1系统下VirtualBox的各种网络配置方法——Bridged networking
- Linux下NFS(网络文件系统)的建立与配置方法
- Linux下NFS(网络文件系统)的建立与配置方法
- Linux下NFS(网络文件系统)的建立与配置方法
- Linux下NFS(网络文件系统)的建立与配置方法
- linux嵌入式编程高手历程系列8-NFS网络文件系统配置方法
- [转]Linux下NFS(网络文件系统)的建立与配置方法
- Linux系统下几点网络基础配置方法说明
- 国内常见网络与安全、主机系统的syslog配置方法(上)
- 在Linux上配置基于Web的网络流量监控系统的方法