Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "RockpiS/network-management"

(Introduction)
 
(5 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
{{Languages|rockpiS/dev/usbnet}}
 
{{Languages|rockpiS/dev/usbnet}}
  
     [[rockpiS | ROCK Pi S]] > [[RockpiS/network-management | ROCK Pi S Network Management]]
+
     [[rockpiS | ROCK Pi S]] > [[RockpiS/network-management | Network Management]]
  
This guide describes how to manage the network on ROCK Pi S.
+
This guide describes how to manage the network on ROCK Pi S running Ubuntu system.
  
=== Introduction ===
+
=== Part 1: Set Ethernet static IP Address ===
Rockpis static address settings.First, install some dependency packages
+
 
    sudo apt-get install netplan.io
+
Install some dependency packages
Create the '''01-netcfg.yaml'''  file in the folder /etc/netplan. If there is no netplan folder, you need to create.
+
 
    sudo mkdir /etc/netplan
+
root@rockpis:~# apt-get install -y netplan.io
    sudo touch /etc/netplan/01-netcfg.yaml
+
 
Add the following to the file '''01-netcfg.yaml'''
+
Create file, /etc/netplan/01-ethernet.yaml. If there is no /etc/netplan folder, create it.
  rock@rockpis:/etc/netplan$ cat 01-netcfg.yaml
+
 
    network:
+
root@rockpis:~# touch /etc/netplan/01-ethernet.yaml
 +
 
 +
Add the following contents to the file, /etc/netplan/01-ethernet.yaml and save it.
 +
 
 +
<pre>
 +
root@rockpis:~# cat /etc/netplan/01-ethernet.yaml  
 +
network:
 
   version: 2
 
   version: 2
 
   renderer: networkd
 
   renderer: networkd
Line 21: Line 27:
 
     eth0:
 
     eth0:
 
       addresses:
 
       addresses:
         - 192.168.2.135/24
+
         - 192.168.1.200/24
       gateway4: 192.168.2.1
+
       gateway4: 192.168.1.1
 
       nameservers:
 
       nameservers:
           search: [mydomain, otherdomain]
+
        addresses:
          addresses: [192.168.2.1, 255.255.255.0]
+
           - "192.168.1.1"
 +
          - "8.8.8.8"
 +
</pre>
 +
 
 +
Run the commands below to apply your changes.
 +
 
 +
root@rockpis:~# netplan apply
 +
 
 +
To validate that your changes are apply, run the commands below to view the IP address configuration detals.
 +
 
 +
root@rockpis:~# ip addr show dev eth0
 +
 
 +
It should display similar lines like the one below:
 +
 
 +
<pre>
 +
root@rockpis:~# ip addr show dev eth0
 +
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
 +
    link/ether c2:68:e0:7c:9b:09 brd ff:ff:ff:ff:ff:ff
 +
    inet 192.168.1.200/24 brd 192.168.1.255 scope global eth0
 +
      valid_lft forever preferred_lft forever
 +
    inet6 fe80::c068:e0ff:fe7c:9b09/64 scope link
 +
      valid_lft forever preferred_lft forever
 +
</pre>
 +
 
 +
=== Part 2: Set Wi-Fi static IP Address ===
 +
 
 +
<pre>
 +
root@rockpis:~# cat /etc/netplan/02-wireless.yaml
 +
network:
 +
  version: 2
 +
  renderer: networkd
 +
  wifis:
 +
    wlan0:
 +
      dhcp4: no
 +
      dhcp6: no
 +
      addresses: [192.168.1.220/24]
 +
      gateway4: 192.168.1.1
 +
      nameservers:
 +
        addresses: [192.168.1.1, 8.8.8.8]
 +
      access-points:
 +
        "rockpi-2.4g":
 +
          password: "rockpistar"
 +
</pre>
 +
 
 +
Run the commands below to apply the changes.
 +
 
 +
root@rockpis:~# netplan apply
 +
 
 +
Validate that your changes are apply.
  
Execute the following command for the configuration to take effect
+
<pre>
    sudo netplan apply
+
root@rockpis:~# ip addr show dev wlan0
then reboot,IP address is what you set.
+
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
 +
    link/ether 4a:33:14:54:4a:03 brd ff:ff:ff:ff:ff:ff
 +
    inet 192.168.1.220/24 brd 192.168.1.255 scope global wlan0
 +
      valid_lft forever preferred_lft forever
 +
</pre>
  
 
=== Troubleshooting ===
 
=== Troubleshooting ===

Latest revision as of 09:21, 8 September 2021

    ROCK Pi S >  Network Management

This guide describes how to manage the network on ROCK Pi S running Ubuntu system.

Part 1: Set Ethernet static IP Address

Install some dependency packages

root@rockpis:~# apt-get install -y netplan.io

Create file, /etc/netplan/01-ethernet.yaml. If there is no /etc/netplan folder, create it.

root@rockpis:~# touch /etc/netplan/01-ethernet.yaml

Add the following contents to the file, /etc/netplan/01-ethernet.yaml and save it.

root@rockpis:~# cat /etc/netplan/01-ethernet.yaml 
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 192.168.1.200/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
          - "192.168.1.1"
          - "8.8.8.8"

Run the commands below to apply your changes.

root@rockpis:~# netplan apply

To validate that your changes are apply, run the commands below to view the IP address configuration detals.

root@rockpis:~# ip addr show dev eth0

It should display similar lines like the one below:

root@rockpis:~# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether c2:68:e0:7c:9b:09 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.200/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::c068:e0ff:fe7c:9b09/64 scope link 
       valid_lft forever preferred_lft forever

Part 2: Set Wi-Fi static IP Address

root@rockpis:~# cat /etc/netplan/02-wireless.yaml 
network:
  version: 2
  renderer: networkd
  wifis:
    wlan0:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.1.220/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [192.168.1.1, 8.8.8.8]
      access-points:
        "rockpi-2.4g":
          password: "rockpistar"

Run the commands below to apply the changes.

root@rockpis:~# netplan apply

Validate that your changes are apply.

root@rockpis:~# ip addr show dev wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 4a:33:14:54:4a:03 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.220/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever

Troubleshooting