Ubuntu Server Guide ☞ 联网 ☞ 网络配置
来源:互联网 发布:中医理疗器材淘宝网 编辑:程序博客网 时间:2024/06/18 11:35
网络配置
Ethernet Interfaces以太网接口
以太网通常通过系统默认的命名规范ethX来进行命名识别的。其中X表示第几块网卡。
通常第一块网卡是eth0,第二块是eth1,以此类推
快速识别以太网接口
ifconfig -a | grep etheth0 Link encap:Ethernet HWaddr 00:15:c5:4a:16:5a
另外一种方式
sudo lshw -class network *-network description: Ethernet interface product: BCM4401-B0 100Base-TX vendor: Broadcom Corporation physical id: 0 bus info: pci@0000:03:00.0 logical name: eth0 version: 02 serial: 00:15:c5:4a:16:5a size: 10MB/s capacity: 100MB/s width: 32 bits clock: 33MHz capabilities: (snipped for brevity) configuration: (snipped for brevity) resources: irq:17 memory:ef9fe000-ef9fffff
临时配置IP 地址
sudo ifconfig eth0 10.0.0.100 netmask 255.255.255.0
配置完成后使用ifconfig eth0来验证配置是否成功
配置默认网关,使用route命令
sudo route add default gw 10.0.0.1 eth0
配置完成后使用route -n命令验证配置是否成
配置DNS
手动编辑/etc/resolv.conf文件
nameserver 8.8.8.8nameserver 8.8.4.4
注意,这种方式是临时的,正确的方式应该是在DNS客户端配置(DNS客户端是什么鬼)
如果不再需要上面的DNS配置使用如下命令刷掉
ip addr flush eth0
注意:如果不能清除/etc/resov.conf那么你就必须手动的去修改这个文件
动态IP配置(DHCP客户端)
在/etc/network/interfaces文件中添加如下内容:
auto eth0
iface eth0 inet dhcp
启动动态IP
sudo ifup eth0
关闭动态IP
sudo ifdown eth0
设置静态IP
配置静态IP只需要修改/etc/network/interfaces文件(IP地址、子网掩码、网关)即可:
auto eth0iface eth0 inet staticaddress 10.0.0.100netmask 255.255.255.0gateway 10.0.0.1
完成以上配置之后同样使用ifup和ifdown命令启动和关闭
Loopback Interface
loopback接口是确认系统中lo具有默认的127.0.0.1的默认IP地址,一般在/etc/network/interfaces文件中有两行来配置该接口,并且一般不建议随便去修改127.0.0.1的映射
auto lo
iface lo inet loopback
名称解析
- Ubuntu Server Guide ☞ 联网 ☞ 网络配置
- Ubuntu Server 网络配置
- Ubuntu Server 网络配置
- Ubuntu Server 网络配置
- ubuntu server 网络配置
- Win7 VMware安装ubuntu网络配置联网
- Ubuntu Server Guide ☞ 包管理 ☞ dpkg
- ubuntu server 9.04 网络配置
- ubuntu server如何配置网络
- ubuntu server的网络配置
- ubuntu server的网络配置
- ubuntu server的网络配置
- ubuntu server 16.04 配置网络
- Ubuntu Server 下的网络配置
- Ubuntu Server 下的网络配置
- Vmware 下的ubuntu server 网络配置
- ubuntu server 14.04 LTS 网络配置
- Ubuntu Server 下的网络配置
- IOS-33-报错:No matching provisioning profiles found: No provisioning profiles matching a
- TED创业的要素
- Eclipse启动时报错:No java virtual machine
- Android FTP服务器搭建与文件上传及下载
- git core.autocrlf配置说明
- Ubuntu Server Guide ☞ 联网 ☞ 网络配置
- Spring使用Cache
- 工业4.0带来了什么
- python3 基于urllib模块的网络编程
- Gradle学习笔记(二)
- 十大负面测试用例
- 用FileInputStream读文件,字节数组接收,不知道文件的大小时怎么办
- xilinx 的 LogiCORE IP Video In to AXI4-Stream 调试
- Wireshark实战分析之DNS协议分析(一)