zoukankan      html  css  js  c++  java
  • beaglebone-black 在Angstrom系统中的网络配置方法

    Beaglebone Linux 101: Assigning a Static IP Address with Connman

    My 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!)

  • 相关阅读:
    公司到底是怎么看我们的……[转]
    C# String.Format 的使用[转]
    Oracle9I 在安装时出现[登台区出现问题,请确保指定有效的“源”和“目标”!]
    街机游戏下载
    C#操作Excel时直接引用Com和InteropExcel的差异
    我所理解的接口和抽象类[转]
    c# winFrom 使窗体显示SplitContainer或Panel中[转]
    SQL Server 2005之PIVOT/UNPIVOT行列转换(转)
    Solaris大半年使用感触
    solaris上的pkg管理
  • 原文地址:https://www.cnblogs.com/dolphi/p/3315486.html
Copyright © 2011-2022 走看看