Arch linux作業系統網路設定詳解

來源:互聯網
上載者:User

介紹一下如果進行網路設定。

[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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.