Hints and tips of system administration
In this page we are giving some hints and tips of system administration. Most of the commands have to be run as root.
The interface with which the
ZynqMP is connected to the private network with the host PC is
ens6 and the interface with which the host PC is connected to the public network is
eno1.
Match those to your respective interfaces.
1 Accept nfs through CentOS firewall
CentOS 7 uses firewalld instead of iptables:
firewall-cmd --permanent --zone=public --add-interface=ens6
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --permanent --add-port=2049/tcp
firewall-cmd --permanent --add-port=2049/udp
firewall-cmd --permanent --add-port=50000/tcp
firewall-cmd --permanent --add-port=50000/udp
firewall-cmd --reload
2 Set nfs exports
mkdir -p /home/ppapageo/NFS
echo '/home/ppapageo/NFS 192.168.1.10(rw,sync,no_root_squash,no_subtree_check,no_acl)' >> /etc/exports
exportfs -a
3 Disable the NetworkManager from configuring your interface
If you are using CentOS 7 with the Network Manager, it will periodically overwrite the IP address of the interface where the ZynqMP is conneced, causing serious connection problems.
To avoid that disable the Network Manager on that particular interface:
echo "NM_CONTROLLED=no" >> /etc/sysconfig/network-scripts/ifcfg-ens6
4 Setup an ntp server using chrony
On the server side:
Enable ntp through the firewall. Then stop the ntp daemon.
firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
systemctl stop ntp
systemctl disable ntp
Add the following configuration to the /etc/chrony.conf
file:
driftfile /var/lib/chrony/drift
keyfile /etc/chrony.keys
manual
allow 192.168.1.0/8
commandkey 1
local stratum 8
Then start the chrony daemon:
systemctl start chronyd
systemctl enable chronyd
On the ZynqMP side:
Edit the /etc/chrony.conf
file:
server pcphl1ct10 iburst prefer minpoll 0 maxpoll 0 xleave
hwtimestamp eth0
allow pcphl1ct10
initstepslew 20 pcphl1ct10
commandkey 24
local stratum 10
log measurements statistics tracking
Edit the /etc/hosts
file and add the following line:
192.168.1.1 pcphl1ct10
Then start the chrony daemon:
systemctl start chronyd
systemctl enable chronyd
You can track the client-host clock syncronization with the command chronyc tracking
.
5 Add internet access via IP masquerading
In our configuration the IP address of the ZynqMP is 192.168.1.10 .
On the host PC side:
See the contents of /proc/sys/net/ipv4/ip_forward
.
cat /proc/sys/net/ipv4/ip_forward
If the output is not 1.
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -I POSTROUTING -s 192.168.1.10/24 -o eno1 -j MASQUERADE
iptables -I FORWARD -s 192.168.1.10/24 -j ACCEPT
On the ZynqMP side:
route add default gw 192.168.1.1
Edit the /etc/resolv.conf
file and add the following line(in place of 137.138.17.5 insert the ipv4 of your DNS server):
nameserver 137.138.17.5
Special thanks to Piotr Nikiel for providing us with this recipe.
-- PanagiotisPapageorgiou - 2019-02-25
Topic revision: r10 - 2019-10-11
- unknown