介紹一下如果進行網路設定。
[root@Arch ~]# ls /sys/class/net/ #查看有哪些可用網路
eno16777736 lo
[root@Arch ~]# ip addr add 1.1.1.21/24 dev eno16777736 #給介面eno16777736配置ip為1.1.1.21 子網路遮罩位255.255.255.0
[root@Arch ~]# ip link set eno16777736 up #啟動網卡,不然無法啟動相關路由
[root@Arch ~]# ip route add default via 1.1.1.2 #設定預設路由、網關
[root@Arch ~]# pacman -S openssh #安裝ssh,不然無法使用xshell等工具進行遠程連結。
[root@Arch ~]# systemctl start sshd #啟動sshd服務,不是ssh哦!
[root@Arch ~]# systemctl enable sshd
Created symlink from /etc/systemd/system/multi-user.target.wants/sshd.service to /usr/lib/systemd/system/sshd.service.
[root@Arch ~]# systemctl | grep sshd
sshd.service loaded active running OpenSSH Daemon #sshd服務運行中
sshdgenkeys.service loaded active exited SSH Key Generation
配置動態網路:
[root@Arch ~]# systemctl enable dhcpcd@eno16777736.service
配置靜態網路:
[root@Arch /]# cd /etc/netctl/
[root@Arch netctl]# cp examples/ethernet-static eno16777736
[root@Arch netctl]# egrep -v "#" eno16777736
Description='A basic static ethernet connection'
Interface=eno16777736
Connection=ethernet
IP=static
Address=('1.1.1.21/24')
Gateway='1.1.1.2'
DNS=('114.114.114.114')
[root@Arch netctl]# netctl enable eno16777736
Created symlink from /etc/systemd/system/multi-user.target.wants/netctl\@eno16777736.service to /usr/lib/systemd/system