临时配置ip
ifconfig eth0 192.168.1.1 netmask 255.255.255.0
缩略:ifconfig eth0 192.168.1.1
停止网卡: ifconfig eth1 down 启动网卡: ifconfig eth1 up
临时配置子接口: ifconfig eth0:0 192.168.1.1 netmask 255.255.255.0 up
永久配置子接口:
修改配置文件:vim /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
IPADDR=192.168.1.1
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
重启网开生效: service network restart
查看
1.ifconfig
2.eth0
3.eth0:0
192.168.1.128/26 ----192.168.1.128/26-192.168.1.191/26
********************************************************************************************************************************
配置主机名:
查看主机名:
hostname
uname -n
临时配置:
hostname helloworld
永久配置
vim /etc/sysconfig/network
HOSTNAME=helloword
********************************************************************************************************************************
添加路由:
查看:route
route -n ---- -n参数不做域名解析
[root@Jasmine Desktop]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 172.16.13.254 0.0.0.0 UG 0 0 0 eth0
********************************************************************************************************************************
添加网关: (添加,默认路由)
route add default gw 172.16.13.254
添加静态路由:
route add -net 192.168.8.0 netmask 255.255.255.0 gw 192.168.1.1
---如果想找到192.168.8.0/24 网段内的IP,可以从192.168.1.1这个网卡接口出去
删除静态路由:
route del -net 192.168.8.0 netmask 255.255.255.0 gw 192.168.1.1
route del default gw 172.16.13.254
ifconfig eth0 192.168.1.1 netmask 255.255.255.0
缩略:ifconfig eth0 192.168.1.1
停止网卡: ifconfig eth1 down 启动网卡: ifconfig eth1 up
临时配置子接口: ifconfig eth0:0 192.168.1.1 netmask 255.255.255.0 up
永久配置子接口:
修改配置文件:vim /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO="none"
NM_CONTROLLED="no"
ONBOOT="yes"
IPADDR=192.168.1.1
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
重启网开生效: service network restart
查看
1.ifconfig
2.eth0
3.eth0:0
192.168.1.128/26 ----192.168.1.128/26-192.168.1.191/26
********************************************************************************************************************************
配置主机名:
查看主机名:
hostname
uname -n
临时配置:
hostname helloworld
永久配置
vim /etc/sysconfig/network
HOSTNAME=helloword
********************************************************************************************************************************
添加路由:
查看:route
route -n ---- -n参数不做域名解析
[root@Jasmine Desktop]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 172.16.13.254 0.0.0.0 UG 0 0 0 eth0
********************************************************************************************************************************
添加网关: (添加,默认路由)
route add default gw 172.16.13.254
添加静态路由:
route add -net 192.168.8.0 netmask 255.255.255.0 gw 192.168.1.1
---如果想找到192.168.8.0/24 网段内的IP,可以从192.168.1.1这个网卡接口出去
删除静态路由:
route del -net 192.168.8.0 netmask 255.255.255.0 gw 192.168.1.1
route del default gw 172.16.13.254