設定IP
1.設定DNS
/etc/sysconfig/network/config
/etc/sysconfig/network/config
FIREWALL="yes"
NETCONFIG_DNS_STATIC_SERVERS="192.168.0.x 168.95.192.1 8.8.8.8"
設定DNS
/etc/resolv.conf
/etc/resolv.conf
nameserver 192.168.0.x
nameserver 168.95.192.1
nameserver 8.8.8.8
(resolv.conf is overwritten with the info in dns-nameservers in /etc/network/interfaces)
/etc/hosts(早期的DNS)
2.設定ip address
/etc/sysconfig/network/ifcfg-eth0
/etc/sysconfig/network/ifcfg-eth0
BOOTPROTO='static' (dhcp)
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='192.168.0.x/24'
MTU=''
NAME=''
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
DHCLIENT_SET_DEFAULT_ROUTE='yes'
3.設定default gateway
/etc/sysconfig/network/routes
/etc/sysconfig/network/routes
default 192.168.0.x - -
default gateway要修改routes(如果沒有要自行增加file routes,dhcp可能沒file)
修改主機名稱
要先檢查2個檔案
1. /etc/sysconfig/network/dhcp
DHCLIENT_MODIFY_SMB_CONF="yes"
DHCLIENT_SET_HOSTNAME="no"(留意這裡)
DHCLIENT_HOSTNAME_OPTION="AUTO"
DHCLIENT_SET_DEFAULT_ROUTE="yes"
DHCLIENT_ROUTE_PRIORITY="0"
2. /etc/hostname
主機名稱
套用新的設定
# systemctl restart network.service
指令修改host name
/etc/hostname
指令: # hostname newname
其他指令
#lspci | egrep -i --color 'network|ethernet'
# ifconfig
# ifstatus eth0
# route -n
# arp -a (Address Resolution Protocol)
(netstat -tlnp
改成
sudo ss -tlnp | cat)
即時改ip and gateway
# ifconfig eth0 192.168.0.x netmask 255.255.255.0 up
# route add default gw 192.168.0.1
address reslution protocol
#arp -a
new tool
net-tools-deprecated
Deprecated Networking Utilities
This package contains the deprecated network utilities arp, ifconfig, netstat and route,
which have been replaced by tools from the iproute2 package:
* arp -> ip [-r] neigh
* ifconfig -> ip a
* netstat -> ss [-r]
* route -> ip r
版本 2.0+git2017... 大小 172.0 KB openSUSE Leap 15.0