---
# System prepended metadata

title: 系統與網路管理
tags: [大四上]

---

# 系統與網路管理
###### tags: `大四上`

### Lab1 
Prepare a HACKMD document with screenshots of Wireshark of ARP and ICMP. Email me the HACKMD link.
![](https://i.imgur.com/Qc98mjs.png)


### Lab2 Linux Routing Table
![](https://i.imgur.com/sus1kyR.png)
#CLIENT
```c=
cd /etc/sysconfig/network-scripts/
cp ifcfg-enp0s3 ifcfg-enp0s8
vi ifcfg-enp0s8
--
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s8"
DEVICE="enp0s8"
ONBOOT="yes"
IPADDR=192.168.1.11
NATMASK=255.255.255.0
GATEWAY=192.168.1.1
--
ifup enp0s8
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1 dev enp0s8
```
#SERVER
```c=+
cd /etc/sysconfig/network-scripts/
cp ifcfg-enp0s3 ifcfg-enp0s8
vi ifcfg-enp0s8

---TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s8"
DEVICE="enp0s8"
ONBOOT="yes"
IPADDR=192.168.2.22
NATMASK=255.255.255.0
GATEWAY=192.168.2.2
---
ifup enp0s8
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.2.2 dev enp0s8
```

### HW2
![](https://i.imgur.com/T728Tx5.png)
![](https://i.imgur.com/nzIZ2Pm.png)

#### 更新
```c=
# sudo su
# apt-get update && apt-get upgrade -y
# timedatectl set-timezone Asia/Taipei      //設定時區
# apt install net-tools                     //安裝網路工具
```
#Client
```c=+
# hostnamectl set-hostname  HOSTNAME        //設定伺服器主機名稱
# hostname                                  //查看主機名稱
# cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak
# vim /etc/netplan/00-installer-config.yaml
network:
  ethernets:
    enp0s3:
      dhcp4: true
    enp0s8:
      addresses: [11.11.11.20/24]
      gateway4: 11.11.11.1
      dhcp4: false
  version: 2
# netplan apply
# route add -net 22.22.22.0 netmask 255.255.255.0 gw 11.11.11.1 dev enp0s8
```
#Server
```c=
# hostnamectl set-hostname  Host-D        //設定伺服器主機名稱
# cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak
# vim /etc/netplan/00-installer-config.yaml
network:
  ethernets:
    enp0s3:
      dhcp4: true
    enp0s8:
      addresses: [22.22.22.30/24]
      gateway4: 22.22.22.1
      dhcp4: false
  version: 2
# netplan apply
# route add -net 11.11.11.0 netmask 255.255.255.0 gw 22.22.22.1 dev enp0s8
```
#Router
```
eth0: DHCP
eth1: 11.11.11.1 、 255.255.255.0
eth2: 22.22.22.1 、 255.255.255.0
```
參考資料 : https://www.footmark.com.tw/news/linux/ubuntu/ubuntu-server-install/#fm-chapter-5-1-2 、 https://www.cnblogs.com/zxc2man/p/6636171.html
apt install netscript-2.4 -y