ifconfig命令(立即生效 重启失效)
ifconfig eth0 192.168.0.11 netmask 255.255.255.0 up 配ip和掩码立即激活
ifdown eth0 关闭eth0 ifup打开
ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx修改mac地址
ifconfig eth0:0 192.168.1.1 netmask 255.255.255.0设置别名
修改配置文档(重启生效)
vi /etc/sysconfig/network 主机名
setup命令
启动和关闭防火墙
即时生效:
#service iptables start
#service iptables stop
3 thoughts on - Linux网络配置
Linux下pppoe上网
which pppd #看是否存在,若没有则需安装
yum install rp-pppoe #安装ppoe客户端
#配置文件/etc/ppp/pppoe.conf,也可如下配置
/usr/sbin/adsl-setup #开始配置
#user name : 输入ADSL帐号的用户名
#输入网卡 默认eth0
#Enter the demand value (default no): 输入 no
#Enter the DNS information here: 输入 server ,这表示使用ADSL拨号自动获得的DNS服务器IP地址
#Please enter your PPPoE password: 输入ADSL帐号的密码
#Choose a type of firewall (0-2): 输入 0 ,不使用防火墙
#Accept these settings and adjust configuration files (y/n)? 如果输入的信息正确,输入 y ,完成配置,否则,输入 n 重新输入
/usr/sbin/adsl-start 启动Linux PPPOE客户端
/usr/sbin/adsl-stop 关闭和ISP的连接
/usr/sbin/adsl-status 查看当前连接的状态
修改主机名三种方法:1、hostname 更改,2、hosts 更改,3、/etc/sysconfig/network
netstat -rn 查看网关 0开头的是默认网关
/etc/resolv.conf 查看DNS