Archlinux设置静态固定IP

最近装了Archlinux,可是每次开机后,设置的IP都没有了,废了好大劲才搞定,俗话说好记性不如烂笔头,特意摘录下来,已备后需。

首先 ifconfig -a 查看自己的网卡,如下

[root@localhost /]# ifconfig -a

enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 3c:97:0e:78:6f:c8  txqueuelen 1000  (Ethernet)
        RX packets 205  bytes 22491 (21.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 129  bytes 39400 (38.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf3a00000-f3a20000
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
wlp3s0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 9c:4e:36:a3:5a:2c  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
由此可以看出,第一块网卡是enp0s25,我们对其进行设置,故在/etc/netctl 下新建文件 enp0s25,并对其进行编辑:

[root@localhost /]# cd /etc/netctl/
[root@localhost /]# nano enp0s25
将其内容修改如下:

Description='enp0s25'
Interface=enp0s25
Connection=ethernet
IP=static
Address=('192.168.0.14/24')
#Routes=('192.168.0.0/24 via 192.168.0.1')
Gateway='192.168.0.1'
DNS=('192.168.0.1')
TimeoutUp=300
TimeoutCarrier=300

之后使用命令netctl其生效,

[root@localhost /]# netctl enable enp0s25

重启Archlinux即可

[root@localhost /]# reboot

效果如下:


可见设置生效。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赵卓不凡

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值