Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Monday, November 15, 2010

Configuring static IP

through command line
OpenSUSE: To specify and adjust your network settings through the command prompt will require root access.
1. Get to the command prompt.
2. Move to the /etc/sysconfig/network directory.
3. Edit the interfaces file and adjust your network settings in this file.
And for windows you can chk the ip address ip-details.com

How to ifconfig down/up a list of IP's
#!/usr/local/bin/php -q
error_reporting(1023);
$file = file( "MyFile");
for($i=0 ; $i < count($file) ; $i++) {
$file[$i]=ereg_replace("[\n]","",$file[$i]);
echo"ifconfig $file[$i] down\n";
exec("ifconfig $file[$i] down\n");
echo"ifconfig $file[$i] up\n";
exec("ifconfig $file[$i] up\n");
}
?>=======================
Distros I've worked with read the network setting from a configuration file, namely /etc/network/interfaces (on Debian and related distros; might be elsewhere in /etc for others). See the man page for interfaces. A quick summary is that in this file, you'll see something like this:
iface eth0 inet dhcp
You just need to change dhcp to static, then on the next 3 lines specify the address, netmask, and gateway. I think the gateway isn't strictly needed, but putting your router's address there doesn't hurt.
How do I open interfaces?? When I ls in /etc/network I see it there, but when i try and get into it, it says its not a directory... Is there a program that I need to use to open it?
As root, use a text editor like nano to open the file:
nano /etc/network/interfaces

How to manually set the MTU

==========================


This HOWTO assumes the eth0 device will be located on the external (public) network.

"You may also note that both IPv4 and IPv6 are fully active on your fresh Linux installation. If you want to disable IPv6 and only run IPv4, you can add the following entry to your "/etc/modprobe.conf" file (this will require a system reboot)
[bash]# vi /etc/modprobe.conf
alias net-pf-10 off

Internal Network Device

The configuration files and initialisation scripts for all of the networking devices are located in the /etc/sysconfig/network-scripts directory, and can easily be edited to adjust the parameters for each device.

The following configuration file for the eth1 device resembles a typical setup.

[bash]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

# Internal Ethernet Device (STATIC)
DEVICE=eth1
TYPE=Ethernet
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
PEERDNS=no
HWADDR=00:0D:61:67:D0:B2             <-- Adjust this, or leave MAC address blank.
IPV6INIT=no

This device is configured with the internal parameters used for the home network. Some minor points to note about the configuration file are:

ONBOOT Specifies whether the devices should start when the system starts (depending on network service)
USERCTL Directs that only root, or all system users can control the device
BOOTPROTO The protocol type used to initialise the device (static | dhcp | none)
PEERDNS Import the DNS nameserver settings into /etc/resolv.conf (careful if running own DNS)
HWADDR Binds the physical MAC address of the device - see caution below

Caution !! Using the HWADDR parameter may cause problems if the MAC address does not match the intended device. For example, changing the physical devices or the name of the alias in /etc/modprobe.conf file. Leave this parameter blank if problematic and adjust later as required.

Note !! Some of the older style parameters like NETMASK and BROADCAST have been deprecated because they can be calculated by the system with the ipcalc command.

The /etc/sysconfig/network file contains basic information about the network in general. The GATEWAYDEV variable should specify which network device will be the gateway to the Internet when the network is fully functional (this may even be the "ppp0" device if using a modem connected to your ISP as your gateway).

[bash]# vi /etc/sysconfig/network

# Network Details
NETWORKING=yes
HOSTNAME=galaxy.example.com
GATEWAYDEV=eth

 Internal Network Device

The configuration files and initialisation scripts for all of the networking devices are located in the /etc/sysconfig/network-scripts directory, and can easily be edited to adjust the parameters for each device.
The following configuration file for the eth1 device resembles a typical setup.

No comments: