config Ip address , subnet ,defult gateway, DNS server manully

how to config Ip address , subnet ,defult gateway, DNS server manully in linux
llvllar1onAsked:
Who is Participating?
 
slyongConnect With a Mentor Commented:
It is inside your /etc/sysconfig/network/routes.  Edit that file and change the line to:

default 192.168.0.1 - -
0
 
slyongConnect With a Mentor Commented:
I am on Fedora Core 4, the configuration file is in:
/etc/sysconfig/network-scripts/ifcfg-eth0
for IP address, subnet, netmask.

/etc/sysconfig/network
for gateway

/etc/resolv.conf
for DNS servers

after changing the file, do:

# service network restart
0
 
ppfoongConnect With a Mentor Commented:

If you are using Mandriva, can use the command "drakconf".

If you are using Redhat, can use the command "netconfig".

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
llvllar1onAuthor Commented:
how about suse and gentoo.....   i am using those two
0
 
nociConnect With a Mentor Software EngineerCommented:
Gentoo:

This file does the trick: /etc/conf.d/net
I think the comments tell it all

If you need an f.e. eth0 to configure
then you also need:

ln -s net.lo /etc/init.d/net.eth0
rc-update add net.eth0


In Suse there is config tool too I think it is called yast
0
 
llvllar1onAuthor Commented:
any command in suse i can use..............
0
 
nociSoftware EngineerCommented:
yast

is the Yet Another Setup Tool.... ;-)
0
 
llvllar1onAuthor Commented:
/etc/sysconfig/network/ifcfg-* . here is the place to change ip setting in suse, but i dont know how to active setting after set excluding reboot.
0
 
nociConnect With a Mentor Software EngineerCommented:
/etc/init.d/<networking or net??> restart
should work...


like in gentoo: '/etc/init.d/net.eth0 start' does the trick withou reboot.
0
 
antoxaConnect With a Mentor Commented:
you can configure it for current session and this settings will be lost after reboot
for example

ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

WBR
0
 
llvllar1onAuthor Commented:
i used vi /etc/sysconfig/network/ifcfg-*. but i dont really know how to modified.
i also tried
ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

and them i typed network restart .  it didnot work either . need help for suse network setting
0
 
antoxaConnect With a Mentor Commented:
after

ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

you don't need to do network restart

because network starting scripts doing the same, but with you static options

for manual changes you must know about your network settings
you must know your IP address (in example 192.168.0.100), your netmask (in example 255.255.255.0), broadcast can be calculated from IP address and netmask, but for 192.168.0.100/255.255.255.0 it will be 192.168.0.255, and you must know your DNS servers, for typing it in /etc/resolv.conf
could you try to configure it with your settings and show results
after 'ifconfig bla-bla' you can check your settings by typing 'ifconfig', you will see your network interfaces
after 'route add default bla-bla' you can check your routing table by typing 'route -vn', you will see your default router
after that you can check you network link by pinging your router 'ping IPaddress'
and if pings resulats is OK, you will configure /etc/resolv.conf


0
 
nociSoftware EngineerCommented:
In the ifcfg-* files there are variables...

NAME=Value

Like:

NETMASK=...
IP=...
GATEWAY=...

These need to be filled out.

Before you just add values, what is the ip address of your Modem/Router to the internet. (=gateway)
If not available then What is the network address. If your network address is something like:
address: 192.168.0.0
netmask 255.255.255.0
what is your gateway (modem/router)
Lets assume 192.168.0.1
What is your DNS server, lets assume your modem handles that too.

Then:

Either setup the ifcfg-* values or do it for onetime to check...

Assume the one time only:

ifconfig eth0 etc like mentioned before
route add like mentioned before

echo "domain mydomain" >/etc/resolv.conf
echo "nameserver 192.168.0.1" >>/etc/resolv.conf

For manual config DONT restart the network, that would introduce values from the ifcfg-* files.

'cat /etc/resolv.conf '

should show 2 lines.

btw, if one ifcfg-* file exists for an interface please paste it here, I have no Suse
setup so for me thats a wild guess to its contents.

0
 
llvllar1onAuthor Commented:
i copied all the setting from my windows such DNS , network, ......
i also ping my route ip 192.168.1.1 . it works . but only for my route ip .
from ifconfig and route , i can see my change is matched.  

not work either....
0
 
llvllar1onAuthor Commented:
ifcfg-* file

BOOTPROTO='dhcp ' ------------------------static
BROADCAST =' ' -----------------------192.168.1.255
IPADDR=''-------------------------------192.168.1.5
MTU=''-----------------------------------1500
NAME='Realtek RT8139'
NETMASK= ''----------------------------192.168.1.1
REMOTE_IPADDR=''--------------------192.168.1.1
STARTMODE='auto'
UNIQUE='rBUF.IQxIdihhuH7
USERCONTROL='no'
_nm_name='bus-pci-0000:00:0b.0'


all data in the  side was entered by me.   left side was default
0
 
antoxaCommented:
NETMASK wrong, it won't be like IP address 192.168.1.1, it will be like 255.255.255.0
0
 
llvllar1onAuthor Commented:
sorry , this was my typo. my setting was 255.255.255.0 for netmask......... i am working fine in dhcp
0
 
antoxaCommented:
please show output of commands:
ifconfig
route -vn
cat /etc/resolv.conf
0
 
nociConnect With a Mentor Software EngineerCommented:
Your values are surrounded by ' marks?

Can you ping an address on the internet?
f.e.
ping 194.109.6.66
or try a traceroute
traceroute -n 194.109.6.66

That woulld tell if routing works at the IP layer works. And how far.

can you give the following information:

netstat -rn
cat /etc/resolv.conf


0
 
llvllar1onAuthor Commented:
finally.  i found i didnot put default gateway. and this command--- route add default gw 192.168.0.1--
only last a while. any one know where to write gateway ?
0
 
llvllar1onAuthor Commented:
my linux box is suse 10
0
 
nociSoftware EngineerCommented:
Isn't it this one?

REMOTE_IPADDR=''--------------------192.168.1.1

Otherwise look for a config file with GATEWAY or such in it
'grep GATEWAY /dir/where/ifcfg-*'
0
 
llvllar1onAuthor Commented:
for noci

both of your suggestions are not work.
0
 
llvllar1onAuthor Commented:
now every time after I added  --------------route add default gw 192.168.0.1-----------

my network is work.  but i dont want to type every time.
0
 
llvllar1onAuthor Commented:
cool. how do you know ---slyong???  i was going to that. but i cannot find this files. in fact, this file (routes) didnot exist in my system.  i will give 100 points for this exact question. looking for answer from anyone!

now the network question is solved . thank you!
0
 
slyongConnect With a Mentor Commented:
llvllar1on,
It is on my SuSE 10.1 also described here http://openskills.info/infobox.php?ID=949.  If the file does not exist, create the file and put in the line:

default 192.168.0.1 - -

also described here http://www.linuxforums.org/forum/suse-linux-help/56290-make-default-gateway-permanent-different-suse-than-red-hat.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.