LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can only change network with GUI, not CLI (https://www.linuxquestions.org/questions/linux-newbie-8/can-only-change-network-with-gui-not-cli-319610/)

learnfast 05-03-2005 02:25 AM

can only change network with GUI, not CLI
 
Why is it that when I say

ifconfig eth0 10.10.0.3 netmask 255.255.0.0
/etc/init.d/network restart

it doesn't connect to the network (can't successfully ping other machines) but (in redhat) when I make the same changes with the GUI "network device control" it then connects to the network.

What else do I have to do beside the two above commands so I am not dependent on the GUI?

hw-tph 05-03-2005 03:14 AM

The network init script most likely reads its settings from a file. Use ifconfig eth0 up instead of running the init script.


Håkan

homey 05-03-2005 06:30 AM

Stop the network with the command: /etc/rc.d/init.d/network stop or
service network stop
Then use the -a option in ifconfig
For example: /sbin/ifconfig -a eth0 192.168.1.2 netmask 255.255.255.0
Verify the settings with /sbin/ifconfig eth0
Add the default gatway: /sbin/route add default gw 192.168.1.1
Verify the gateway setting: /sbin/route.
The line beginning with default should have your gateway under the gateway column.

You can edit / check the settings in the files
Code:

/etc/sysconfig/network-scripts/ifcfg-eth0

        DEVICE=eth0
        USERCTL=no
        ONBOOT=yes
        BOOTPROTO=none
        BROADCAST=192.168.1.255
        NETWORK=192.168.1.0
        NETMASK=255.255.255.0
        IPADDR=192.168.1.2

and  /etc/sysconfig/network.

        NETWORKING=yes
        HOSTNAME=comp1.mydomain.com
        FORWARD_IPV4=yes
        GATEWAYDEV=
              GATEWAY=192.168.1.1

Don't forget to restart the network with the command: /etc/rc.d/init.d/network start or
service network start


All times are GMT -5. The time now is 02:25 AM.