Linux 修改 IP DNS 参数 配置

一、修改 IP 地址

[leakon@linux]$ vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=static

IPADDR=219.236.108.199

NETMASK=255.255.255.192

GATEWAY=219.236.108.254

二、修改 GATEWAY

vim /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=leakon.com

GATEWAY=192.168.10.128

三、修改 DNS

[leakon@linux]$ vim /etc/resolv.conf

nameserver 202.99.160.68

nameserver 202.99.168.8

四、重新加载网络配置

/etc/init.d/network restart

修改 IP 地址

  • 即时生效
    # ifconfig eth0 192.168.10.108 netmask 255.255.255.0
  • 启动生效
    vim /etc/sysconfig/network-scripts/ifcfg-eth0

修改 Default Gateway

  • 即时生效
    # route add default gw 192.168.10.192
  • 启动生效
    vim /etc/sysconfig/network-scripts/ifcfg-eth0

修改 DNS

  • vim /etc/resolv.conf
  • 修改后立即生效,启动亦有效

修改 Host Name

  • 即时生效:
    # hostname leakon.com
  • 启动生效:
    vim /etc/sysconfig/network

Tags: ,

Leave a Reply

Your email address will not be published.

*