Static IP
This help sheet has been developed for students living in CSM Residences and faculty/staff members on the main campus who wish to set up a network connection on their PC running Linux. It describes the basic steps necessary to establish communication between your PC and the Internet using TCP/IP (Transmission Control Protocol/Internet Protocol). The instructions are written for RedHat7.x, but the steps described should be similar for other distributions of Linux.
Visit https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-interfaces.html for additional help.
1. Edit your NIC configuration file
Your Location |
Gateway |
Network |
Broadcast |
Netmask |
Main Campus |
138.67.1.1 |
138.67.0.0 |
138.67.63.255 |
255.255.192.0 |
Log in as root and make the following changes to the ifcfg-eth0 file using a text editor such as pico or vi:
- DEVICE=eth0
- BOOTPROTO=static
- BROADCAST=your broadcast address
- IPADDR=your IP address (Given to you when your port is activated.)
- NETMASK=your netmask
- NETWORK=your network
- ONBOOT=yes
- DNS1=138.67.1.2
- DNS2=138.67.1.3
2. Edit your network configuration
file
- NETWORKING=YES
- HOSTNAME=your hostname (Given to you when your port is activated.)
- GATEWAY=your gateway
3. Verify that the changes have
taken effect
If you are interested in a more secure connection, look up iptables, which deal with firewalls.
- Create a
file named /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:
- DEVICE=eth0
- BOOTPROTO=none
- ONBOOT=yes
- PREFIX=24
- IPADDR=192.168.2.203
- Restart
network service: systemctl restart network
How do I list network interfaces?
Type the following command:Here is a typical DHCP configration for eth0 (stored in /etc/sysconfig/network-scripts/ifcfg-eth0 file):
No comments