Linux Network - yenbohuang/techNotes GitHub Wiki
sudo nano /etc/hosts
See details on http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file
netstat -anp
See details on https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/Security_Guide/s1-server-ports.html
sudo iptables -t nat -L -n
See details on http://ipset.netfilter.org/iptables.man.html
sudo apt-get install openssh-server
sudo service sshd start
sudo service sshd start
See details on https://lecturesnippets.com/lesson/setting-up-ssh-server-in-centos-7-minimal-install/
This is a bad practice. Do not enable root login in production environment.
- Open
/etc/ssh/sshd_config
and change:- PermitRootLogin yes
- PasswordAuthentication yes
sudo service sshd restart
See details on:
- Add nameserver in this file
sudo nano /etc/resolvconf/resolv.conf.d/head
- Add search in this file
sudo nano /etc/resolvconf/resolv.conf.d/tail
- Update
sudo resolvconf -u
See details on http://www.lampnode.com/linux/howto-setup-nameserver-on-ubuntu-1404-by-resolvconf/
- Make nameserver permanent
Add PEERDNS=no
to /etc/sysconfig/network-scripts/ifcfg-***
.
See details on https://www.centos.org/forums/viewtopic.php?t=62970
sudo mount -t cifs \
-o username=${name},password=${pwd},uid=${uid},gid=${gid} \
${network path} ${local path}
See details on http://unix.stackexchange.com/questions/68079/mount-cifs-network-drive-write-permissions-and-chown
scp SourceFile user@host:directory/TargetFile
scp user@host:directory/SourceFile TargetFile
See details on http://webdev.gmu.edu/uploading-files-with-secure-copy-scp/.
Configure the Firewall Using the Command Line:
sudo lokkit --port=123:udp --update
Checking Network Access for Incoming NTP Using the Command Line
sudo less /etc/sysconfig/system-config-firewall
See details on https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-Configure_the_Firewall_Using_the_CLI.html.
curl -v -X PUT -d <content> http://localhost/api/handler
curl http://localhost/somefile.zip > /tmp/myfile.zip
- Use
ifconfig
and know which NIC we are updating. - Open
/etc/sysconfig/network-scripts/ifcfg-???
and change:- BOOTPROTO=none
- ONBOOT=yes
- DNS1=???
- DOMAIN=??
- IPADDR=??
- PREFIX=24
- GATEWAY=??
sudo systemctl restart network
Or, use UI tool:
sudo nmtui
See details on:
- https://www.cyberciti.biz/faq/howto-setting-rhel7-centos-7-static-ip-configuration/
- http://ask.xmodulo.com/configure-static-ip-address-centos7.html
After installing CentOS in Virtual Box, the VM is not ready to use NAT network connection. We need to enable DHCP and restart network.
- Edit this config file:
sudo nano /etc/sysconfig/network-scripts/ifcfg-enp3s0
- Add the following configurations:
DEVICE=enp3s0
ONBOOT=yes
DHCP=yes
- Restart network:
sudo ifdown enp0s3
sudo ifup enp0s3
See details on:
sudo systemd-resolve --flush-caches
dig <FQDN>
See details on:
Intranet
nmblookup -A <IP address>
Internet
nslookup <IP address>