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

  • 相关阅读:
    Jupyter 魔术命令(magic commands)
    Matplotlib中plt.rcParams用法(设置图像细节)
    Neural Networks and Deep Learning(week4)Building your Deep Neural Network: Step by Step
    C语言上机复习(一)文件操作
    Neural Networks and Deep Learning(week4)深层神经网络(Deep Neural Networks)
    maven pom.xml几个特殊的插件
    maven pom.xml中的 build说明
    pom.xml的继承、聚合与依赖
    eclipse自动补全设置
    maven insall跳过测试
  • 原文地址:https://www.cnblogs.com/dolphi/p/3315486.html
Copyright © 2011-2022 走看看