kisscommunity

kisscommunity.bvnf.space site sources
git clone git://bvnf.space/home/kiss/kisscommunity.git
Log | Files | Refs | Submodules | README | LICENSE

index.txt (8625B)


      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
DHCPCD [0]
________________________________________________________________________________

Dynamic Host Configuration Protocol Client Daemon is a popular DHCP client
capable of handling both IPv4 and IPv6 configuration.


Dynamic IP Configuration
________________________________________________________________________________

Begin by first verifying that you have dhcpcd installed:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ kiss b dhcpcd && kiss i dhcpcd                                           |
|                                                                              |
+------------------------------------------------------------------------------+

Once installed, dhcpcd can be used to automatically configure a network device
interface:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ dhcpcd INTERFACE                                                         |
|                                                                              |
+------------------------------------------------------------------------------+

Remember to replace INTERFACE in the command above with the name of the device
that you wish to configure.

A network device's interface status can be inspected via ip-link:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ ip link show dev INTERFACE                                               |
|                                                                              |
+------------------------------------------------------------------------------+

ip-link can also be used to enable or disable an interface:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ ip link set INTERFACE down  # disable the interface                      |
|   $ ip link set INTERFACE up    # enable  the interface                      |
|                                                                              |
+------------------------------------------------------------------------------+


Static IP Configuration
________________________________________________________________________________

Continuing from the previous section, we can use ip-address to display the
current DHCP address information:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ ip address show                                                          |
|                                                                              |
+------------------------------------------------------------------------------+

Using the output of the previous command, add the following lines to the
/etc/dhcpcd.conf file using your preferred text editor:

+------------------------------------------------------------------------------+
|                                                                              |
|   interface INTERFACE                                                        |
|   static ip_address=STATIC_IP                                                |
|   static routers=GATEWAY                                                     |
|   static domain_name_servers=DNS_SERVER                                      |
|                                                                              |
+------------------------------------------------------------------------------+

Remember to replace the INTERFACE, STATIC_IP, GATEWAY and DNS_SERVER in the
block above with your own parameters.


Hostname
________________________________________________________________________________

A system's hostname can be set by simply creating a /etc/hostname file:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ echo "HOSTNAME" > /etc/hostname                                          |
|                                                                              |
+------------------------------------------------------------------------------+

Remember to replace HOSTNAME with the string of your choosing.

Note: Valid characters for hostnames include ASCII letters from A to Z, digits
      from 0 to 9, and the hyphen character (-). A hostname may not start with
      a hyphen.


Managed via runsv
________________________________________________________________________________

Busybox's runsv can be used to create a new managed service with the following
command:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ ln -s /etc/sv/dhcpcd/ /var/service                                       |
|                                                                              |
+------------------------------------------------------------------------------+

To start the new managed service, use the following command:

+------------------------------------------------------------------------------+
|                                                                              |
|   $ sv up dhcpcd                                                             |
|                                                                              |
+------------------------------------------------------------------------------+


Tips and Tricks
________________________________________________________________________________

* A list of possible INTERFACE names can be obtained by running the following:

  +----------------------------------------------------------------------------+
  |                                                                            |
  |   $ ls /sys/class/net                                                      |
  |                                                                            |
  +----------------------------------------------------------------------------+

* The ping command can be used to verify connectivity with a network device
  interface:

  +----------------------------------------------------------------------------+
  |                                                                            |
  |   $ ping www.google.com                                                    |
  |                                                                            |
  +----------------------------------------------------------------------------+

* Some network administrators require that the hostname and domain name provided
  by the DHCP server is used by the system. In that case, pass the "-HD" switch:

  +----------------------------------------------------------------------------+
  |                                                                            |
  |   $ dhcpcd -HD INTERFACE                                                   |
  |                                                                            |
  +----------------------------------------------------------------------------+

* If you are not sure what to put in the STATIC_IP, GATEWAY and DNS_SERVER, you
  can use the following example for reference:

  +----------------------------------------------------------------------------+
  |                                                                            |
  |   interface eth0                                                           |
  |   static ip_address=192.168.0.4/24                                         |
  |   static routers=192.168.0.1                                               |
  |   static domain_name_servers=192.168.0.1                                   |
  |                                                                            |
  +----------------------------------------------------------------------------+

  Notice the "/24" suffix, which is an abbreviation for the subnet mask
  255.255.255.0. Also, GATEWAY and DNS_SERVER are the same in this example.


References
________________________________________________________________________________

[0] https://github.com/rsmarples/dhcpcd
[1] https://wiki.archlinux.org/index.php/Network_configuration
[2] https://wiki.gentoo.org/wiki/Dhcpcd