Linux静态IP及DNS配置
来源:互联网 发布:java工程师和架构师 编辑:程序博客网 时间:2024/05/18 01:21
以eth0为例,下面是其配置文件示例。
主要是配置红色部分。
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:A3:48:38
TYPE=Ethernet
UUID=afeca381-c5c1-4dfe-9e8a-ec573dbd04f7
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.124.250
NETMASK=255.255.255.0
GATEWAY=192.168.124.1
DNS1=192.168.124.1
配置完成后,通过ifdown/ifup脚本重启网卡。注意,不要简单的使用ifconfig命令。
[root@localhost ~]# ifdown eth0
[root@localhost ~]# ifup eth0
最后查看配置是否生效,并实测ping网关与互联网网站,看看通不通。
[root@localhost ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:A3:48:38
inet addr:192.168.124.250 Bcast:192.168.124.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fea3:4838/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2473 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:310768 (303.4 KiB) TX bytes:1293 (1.2 KiB)
Interrupt:19 Base address:0x2000
[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
domain localdomain
search localdomain
nameserver 192.168.124.1
nameserver 192.168.13.1
[root@localhost ~]# ping 192.168.124.1
PING 192.168.124.1 (192.168.124.1) 56(84) bytes of data.
64 bytes from 192.168.124.1: icmp_seq=2 ttl=128 time=15.2 ms
64 bytes from 192.168.124.1: icmp_seq=3 ttl=128 time=10.6 ms
64 bytes from 192.168.124.1: icmp_seq=4 ttl=128 time=3.63 ms
^C
--- 192.168.124.1 ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3380ms
rtt min/avg/max/mdev = 3.636/9.853/15.253/4.778 ms
[root@localhost ~]# ping www.baidu.com
PING www.baidu.com (180.97.33.107) 56(84) bytes of data.
64 bytes from 180.97.33.107: icmp_seq=1 ttl=57 time=428 ms
64 bytes from 180.97.33.107: icmp_seq=2 ttl=57 time=4.28 ms
64 bytes from 180.97.33.107: icmp_seq=3 ttl=57 time=74.0 ms
64 bytes from 180.97.33.107: icmp_seq=4 ttl=57 time=29.7 ms
^C
--- www.baidu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3420ms
rtt min/avg/max/mdev = 4.285/134.260/428.909/171.940 ms
[root@localhost ~]#
- Linux静态IP及DNS配置
- Centos配置静态IP及DNS
- virtualbox中ubuntu配置静态ip地址及DNS
- virtualbox中ubuntu配置静态ip地址及DNS
- ubuntu12.04配置静态IP及设置DNS
- virtualbox中ubuntu配置静态ip地址及DNS
- ubuntu12.04配置静态IP及设置DNS
- virtualbox中ubuntu配置静态ip地址及DNS
- Linux上设置静态网络配置,ip/gateway/DNS
- Linux下配置静态IP 设置DNS和主机名
- Linux下配置静态IP地址,设置DNS和主机名
- 详述Linux配置静态IP、设置DNS和主机名
- 详述Linux配置静态IP、设置DNS和主机名
- Linux下配置静态IP地址,设置DNS和主机名
- linux debian配置静态IP,网关,DNS详细步骤
- ubuntu配置静态IP和静态DNS
- Linux上网配置(IP地址及DNS的配置)
- linux 配置静态IP及相关命令
- 《如何在WordPress上添加微信/支付宝打赏功能》
- Huffman Tree、AVL、SplayTree、Skip List、2-3-4 Tree、rb-Tree、B-Tree特性辨析与总结
- Loadrunner的最初调试
- Android数字动态显示,仿支付宝app效果简单的实现。字数从0-x!!!
- 04-树4 是否同一棵二叉搜索树
- Linux静态IP及DNS配置
- 进程&进程间通信
- POJ 2175 Evacuation Plan 费用流消圈算法
- mysql drop table 出现 Cannot delete or update a parent row:
- Android 点击
- HDU 3263 (平面几何)
- 函数笔记
- poj1062昂贵的聘礼(题解)最短路
- Android简易实战教程--第十五话《在外部存储中读写文件》