Linux服务器配置IP地址的步骤如下:打开终端,使用 root 用户登录;
Linux服务器配置IP地址的步骤如下:
1. 打开终端,使用 root 用户登录;
2. 运行 ifconfig 命令,查看网卡的名称;
3. 运行 vi /etc/sysconfig/network-scripts/ifcfg-eth0 命令,打开网卡配置文件;
4. 在文件中输入 IPADDR=192.168.0.10,NETMASK=255.255.255.0,GATEWAY=192.168.0.1;
5. 保存文件,退出 vi 编辑器;
6. 运行 service network restart 命令,重启网络服务;
7. 运行 ifconfig 命令,查看 IP 地址是否已经更改。
以上代码如下:
# Login as root
su -
# Check the network card name
ifconfig
# Edit the network card configuration file
vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Add the following lines in the file
IPADDR=192.168.0.10
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
# Save and exit
:wq
# Restart the network service
service network restart
# Check the IP address
ifconfig
本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处
评论列表(40条)