Archlinux设置静态ip

1. 查看网卡名称

$ ifconfig

2. 复制配置文件例子。

# cp /etc/netctl/examples/ xxxxx  ../xxxxx

3. 编辑配置文件

# vim /etc/netctl/xxxxxx

##################################################
Description='A basic static ethernet connection'  //描述文件
Interface=xxxxxxxx   //改上自己的网卡名称
Connection=ethernet
IP=static
Address=('192.168.1.20/24')    //填写自己的ip地址
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='192.168.1.1'
DNS=('192.168.1.1')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

4. 启动配置文件

# netctl enable xxxxxx

5. 重启即可。

猜你喜欢

转载自www.cnblogs.com/mc-r/p/11588182.html