System Administration
For Debian and CentOS
Table of contents:
Table of contents:
- Interfaces
- Routing
- Firewall(iptables)
- IPs and Ports
- Services
- Users and Groups
- Package Management
- ipmitool
- Other system commands
-
INTERFACES
-
Show physical (or virtualized) network cards:
-
Show interfaces:
If you do not see your interface in ip link, you can check for errors in dmesg. -
Check interface for link and speed:
Returns something like: This translates to a Gigabit connection(1000baseT-HD) with a cable plugged in(link on). You can also check for these values without root permissions by looking into: If carrier is 1, then you have a cable plugged in. The speed might be 0 when it's unknown. operstate might also give you a hint if the cable is plugged in or not. You can also use ethtool for this (if you don't mind installing a new tool). If you do not see your interface in ip link, you can check for errors in dmesg. -
Manage interface with the ip command
-
Create VLAN:
Make sure that the kernel module 8021q is loaded Then create new VLAN interfaces by running: Then you can simply use it as a normal interface.
-
Show physical (or virtualized) network cards:
-
ROUTING
-
Show routing table:
or or -
List routing table entries for a specific table:
The default table name is main but you can have more than one table. In this case the table name is "200". You can then use rules to specify which routing table should be applied. -
Add routing table entry:
The following routing directive tells the Kernel that every packet that is going to the 192.168.100.X network, needs to be forwarded through the 10.9.8.1 gateway - through the tun1 device. -
Remove routing table entry:
To remove an entry (like the one above) you can run: -
Show list of rules:
-
Add route to table:
This adds a new routing instruction to table 200: To delete the routing instruction, simply replace add with delete. On OpenBSD you can use something like: -
Add rule:
This adds a new rule saying that traffic coming from 192.168.1.0/24 should be handled by routing table with name "200": To delete the rule, simply replace add with delete
-
Show routing table:
-
FIREWALL (iptables)
-
Show firewall rules:
-
Delete firewall rule:
-
Insert firewall rule at position (Rules are applied in order):
-
Forward traffic from/to VPN tunnel:
-
Show firewall rules:
-
IPs and Ports
-
List active internet connections (servers and established):
-
Check if someone is listening on port 25:
-
Check if you can connect to 127.0.0.1/3306:
An exit code of 0 means that it was able to connect, and 1 means that it could not connect in the given timeout of 1 second. -
Convert IP to domain and domain to IP:
-
List active internet connections (servers and established):
-
Services(daemons)
-
List available services:
-
Status:
-
Start:
-
Stop:
-
Restart:
-
Enable (set to start at boot):
-
Disable (prevent start at boot):
-
List available services:
-
Users and groups
-
To manage users on your system run:
-
To manage groups on your system:
-
To manage users on your system run:
- Package Management Moved to: /kb/linux/software_packages .
-
ipmitool
-
Other system commands
To see when the system was installed you can check when the / partition(filesystem) was created using (requires root): To set the hostname of a certain computer you can: Remember that you have to restart bash, in order to have it load