Linux网络配置
来源:互联网 发布:如何利用碎片时间知乎 编辑:程序博客网 时间:2024/05/21 03:56
一、CentOS
ls -l /etc/sysconfig/network-scripts/ifcfg*
vi /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/init.d/network restart
# vi /etc/sysconfig/network
NETWORKING=yes #表示系统是否使用网络,一般设置为yes。如果设为no,则不能使用网络。
HOSTNAME=centos #设置本机的主机名,这里设置的主机名要和/etc/hosts中设置的主机名对应
GATEWAY=192.168.1.1 #设置本机连接的网关的IP地址。
二、ubuntu
ifconfig -a 查看所有网卡
vi /etc/network/interfaces 编辑IP地址
auto eth2
#iface eth2 inet dhcp
iface eth2 inet static
address 192.168.132.112 (IP地址)
netmask 255.255.255.0 (子网掩码)
network 192.168.132.0 (网络地址)
broadcast 192.168.132.255 (广播地址)
gateway 192.168.132.254 (网关地址)
/etc/init.d/networking restart 重启网卡
vi /etc/resolv.conf 编辑DNS
update-rc.d networking defaults 设置系统启动后自动启用网卡
三、Ubuntu临时变更IP地址
ifconfig eth2 192.168.132.112/24 设置IP和子网掩码
route add default gw 192.168.1.1 设置网关地址
ech2 nameserver 192.168.1.1 > /etc/resolv.conf 设置DNS地址
/etc/init.d/networking restart 重启网卡(BT5)
/etc/init.d/network restart ###centos6
自动获取IP
dhclient eth2
- 网络 linux网络配置
- linux配置网络配置
- Linux网络基本网络配置
- 【网络】Linux网络相关配置
- Linux网络基本网络配置
- linux网络配置基础
- Linux网络配置
- 手动配置linux网络
- linux 网络配置
- linux 网络配置
- Linux网络配置
- Linux网络环境配置
- LINUX网络配置
- Linux 网络配置ifconfig
- linux网络配置
- Linux 网络配置
- linux 网络配置
- redhat linux网络配置
- 计算直线的交点数
- ActiveSync 在 Win7(32位) 与 WinCE7 之间使用出现的问题
- HTML5地理位置定位 Geolocation API
- 模拟——Help Me with the Game
- Java Cloneable
- Linux网络配置
- 【每日一C之八】C语言static用法
- 第三章作业
- makefile自动化变量及其说明
- VC当中将CString转换为char
- 六周 项目1 体验常成员函数 没有写完!!
- win32 api
- Linux内核的Oops
- 关于Union和Struct对齐