BIOS开启VT支持
CentOS DNS配置
Linux 下设置DNS位置有3处,其生效顺序例如以下:
- /etc/hosts
- 网卡配置文件DNSserver地址
- /etc/resolv.conf
通过设置主机表地址进行特定主机的解析,优先DNSserver地址,/etc/hosts:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 123.125.114.144 www.baidu.com #手动指定百度的IP
在/etc/hosts配置www.baidu.com的网址后,可以用ping www.baidu.com
命令来观看ping的地址是否是123.125.114.114
Linux中默认的DNSserver地址配置文件为/etc/resolv.conf:
nameserver 114.114.114.114 nameserver 8.8.8.8
在网卡配置文件里加入DNSserver地址。 /etc/sysconfig/network-scripts/ifcfg-eno16777736:
DNS1=114.114.114.114 DNS2=8.8.8.8
解析域名的方法:
[root@localhost]# nslookup baidu.com Server: 114.114.114.114 Address: 114.114.114.114#53 Non-authoritative answer: Name: baidu.com Address: 220.181.57.217 Name: baidu.com Address: 111.13.101.208 Name: baidu.com Address: 123.125.114.144 Name: baidu.com Address: 180.149.132.47 [root@localhost]# host baidu.com baidu.com has address 180.149.132.47 baidu.com has address 220.181.57.217 baidu.com has address 111.13.101.208 baidu.com has address 123.125.114.144 baidu.com mail is handled by 10 mx.n.shifen.com. baidu.com mail is handled by 20 mx1.baidu.com. baidu.com mail is handled by 20 jpmx.baidu.com. baidu.com mail is handled by 20 mx50.baidu.com. [root@localhost]# dig baidu.com baidu.com. 202 IN A 111.13.101.208 baidu.com. 202 IN A 123.125.114.144 baidu.com. 202 IN A 180.149.132.47 baidu.com. 202 IN A 220.181.57.217
CentOS网络配置
su root
切换到root用户,编辑配置文件vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
HWADDR=00:0C:29:23:C4:B1 #ip link show查看 TYPE=Ethernet #BOOTPROTO=dhcp BOOTPROTO=static IPADDR=192.168.0.122 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 DNS1=114.114.114.114 DNS2=8.8.8.8 DEFROUTE=yes PEERDNS=yes PEERROUTES=yes NM_CONTROLLED=no IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eno16777736 UUID=ebd7eace-f0b7-4d48-b4d6-fd6ee3f7e21d #nmcli con show # ONBOOT=no ONBOOT=yes
service network restart
重新启动网络
ping baidu.com
是否可以ping通百度
配置多个网卡
配置第二个时,须要自己创建配置文件。在重新启动网卡之前,停止NetworkManager
systemctl stop NetworkManager
systemctl disable NetworkManager
时间配置
配置本地时区:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
同步网络时间:
yum install ntpdate
ntpdate pool.ntp.org
Samba服务配置
yum install samba samba-client samba-common
安装相关软件
# rpm -qa | grep samba samba-4.1.12-23.el7_1.x86_64 samba-libs-4.1.12-23.el7_1.x86_64 samba-common-4.1.12-23.el7_1.x86_64 samba-client-4.1.12-23.el7_1.x86_64
这里顺便说一下搭建sambaserver所须要的基本软件包:
1. samba 这个软件包包括了基本的daemon文件(smbd和nmbd)
2. samba-common 提供samba的主要配置文件(smb.conf)、smb.conf语法检測程序(testparm)等
3. samba-client 当linux作为samba 客户端的时候。提供了一套所需的工具和指令。
备份配置文件cp /etc/samba/smb.conf /etc/samba/smb.conf.$(date +%F)
编辑vim /etc/samba/smb.conf
[global] workgroup = MYGROUP server string = Samba Server Version %v log file = /var/log/samba/log.%m max log size = 50 security = user passdb backend = tdbsam load printers = yes cups options = raw [samba] comment = my share dir path = /home/user browseable = yes guest ok = yes writable = yes public = yes
加入用户smbpasswd -a samba_user
,设置password
重新启动服务
service smb restart
service nmb restart
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
Linux下客户端測试
smbclient -L //192.168.0.122/samba -U samba_user
设置开机启动
systemctl enable smb.service
Win8下加入网络位置
进入我的电脑。【右击】-【加入网络位置】依据向导一直点击【下一步】,在Internet地址或网络位置下填写\\192.168.0.122\samba
,【下一步】依据提示填写用户与password。
安装必备软件
- 安装gcc:
yum -y install gcc
- 安装g++:
yum -y install gcc-c++
- 安装gccgo:
yum -y install gcc-go
- 安装小工具:
yum -y install lrzsz screen
yum -y install socat nc nmap
获取本机公网ip
curl http://members.3322.org/dyndns/getip
-
curl ipinfo.io
{ "ip": "36.110.42.197", "hostname": "No Hostname", "city": "Beijing", "region": "Beijing Shi", "country": "CN", "loc": "39.9289,116.3883", "org": "AS4847 China Networks Inter-Exchange" }
參考:
原文链接:https://www.cnblogs.com/mengfanrong/p/5350526.html
原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/21959