ifconfig enp4s0 192.168.1.11 netmask 255.255.255.0 up
and
ip route add default via 192.168.1.1
works but wont survive reboot then I ccheked how to wirte init scripts and I came along with smth like this
#!/bin/bash
### BEGIN INIT INFO
# Provides: statip
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $null
# Default-Start: 3 5
# Default-Stop: 0 1 6
# Short-Description: your description
# Description: your description
### END INIT INFO
# Path to executable
statip=/bin/stat_IP
test -x "$statip" || exit 5
# Include status script
. /etc/rc.status
rc_reset
case "$1" in
start)
echo -n "Starting service statip"
$statip # tu zmena
rc_status -v
;;
stop)
echo -n "Shutting down service statip"
killproc -TERM $statip
rc_status -v
;;
try-restart|condrestart)
# Restart only if program is running
$0 status
if $? = 0 ]; then
$0 restart
else
rc_reset
fi
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
reload|force-reload)
echo -n "Reloading service statIP"
killproc -HUP $statip
rc_status -v
;;
status)
echo -n "Checking status of service statIP"
checkproc $statip
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|status}"
exit 1
;;
esac
rc_exit
I put that ifconfig and ip command in that
/bin/stat_IP
ANd my question is : is it correct and if just make symbolic link to that script in correscponding runlevel like ln -s /init.d/staticIP /init.d/rc3.d rename it to S30staticIP and S50staticIP in runlevel 3,5 for start script and for stop script in 0,1,6 K0staticIP …
On 2014-01-17 13:26, roberto68 wrote:
>
> I’m trying to set up static IP command
> Code:
> --------------------
> ifconfig enp4s0 192.168.1.11 netmask 255.255.255.0 up
> --------------------
> and
Why?
Why not use the services the system already provides?
> I put that ifconfig and ip command in that
> Code:
> --------------------
> /bin/stat_IP
> --------------------
> ANd my question is : is it correct and if just make symbolic link to
> that script in correscponding runlevel like ln -s /init.d/staticIP
> /init.d/rc3.d rename it to S30staticIP and S50staticIP in runlevel 3,5
> for start script and for stop script in 0,1,6 K0staticIP …
Will never work. Not with systemv, nor with systemd.
Read the openSUSE documentation on how the boot process works.
–
Cheers / Saludos,
Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)
because whne I swithc networking to ifup and turn of network manager and dhcp and configure /etc/sysconfig/network/enp4s0 ( is interface I’m connected to router thru) it says some dependecies problem and I found a thread in suseforums where other fella also stated this problem and seems like it’s a bug (maybe solved since that)
Yes, it does not survive a system shutdown, because it is in the kernel.
Why not using YaST. That worked for me (and many. many others) without problems for many years. In fact YaST indeed puts this in files in /etc/sysconfig/network. But why not using YaST?
and how to disable dhcp daemon, cause I’ve not found any decent answer nothing in /init.d and in sysconfig dont know what particular option it is. ANd funny thing is through generic mozilla no page is available, but through TOR’s mozilla everything si OK ??? WTF is that
That is also in YaST > Network devices > Network settings.
Select the network device you want to configure and click Edfit. There you can choose between DHCP or Statically assigned IP address. They are mutualy exclusive of course. And when oyu choose Statically …, you can fill in IP address and Subnet Mask and Hostname.
It seems al rather logical and intuitive to me. What is your problem? I hope I do not have to copy all what is to be seen on that screen here in the post.
I’ve figured that out I’ve not assigned DNS server. and my question is will Yast save those statci settings if I’ve to use dhcp sometimes and then turn on static IP whne I’m back home (I’m on laptop). and I mean like dhcp won’t start at next boot, I want to turn dhcp daemon or yast will take care of that?
What you configure in YaST is either stored directly in configuration files (like /etc/resolv.conf) or in files in /etc/sysconfig/network to be used when the network scripts run (usualy at boot).
On Fri 17 Jan 2014 06:46:01 PM CST, roberto68 wrote:
and how to disable dhcp daemon, cause I’ve not found any decent answer
nothing in /init.d and in sysconfig dont know what particular option it
is
Hi
Sysvinit is gone, it’s using systemd now, so systemctl is your friend.
But as Henk advised, YaST will do what is needed, including disabling
dhcp. Don’t forget to add the gateway address, dns and search.
–
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.2 Kernel 3.11.6-4-desktop
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!
On 2014-01-17 20:36, roberto68 wrote:
>
> I’ve figured that out I’ve not assigned DNS server. and my question is
> will Yast save those statci settings if I’ve to use dhcp sometimes and
> then turn on static IP whne I’m back home (I’m on laptop). and I mean
> like dhcp won’t start at next boot, I want to turn dhcp daemon or yast
> will take care of that?
If you are using a laptop and changing network sites, it is best you use
network manager instead. It is designed for that.
To switch network types and configs using ifup, the traditional method
was to use “scpm” - however, I tested it briefly under systemd and I
think it is broken. Which is a real pity.
–
Cheers / Saludos,
Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)
On 01/18/2014 02:06 AM, deano ferrari wrote:
> Alternatively, the OP may like to checkout wicd-curses for CLI control
> of wired/wireless networks.
Be careful with wicked, which is the new (well-deserved) name for wicd. I
installed it last week to help a user, and I was unable to return to NM when the
test was done. After several hours of trying to get NM reinstalled, I ended up
reinstalling the entire openSUSE!
thanks folks, I solve it on my own. I will probably wirte solo thread about this so others could know how to set static IP. So at 1st) in the the yast->network devices->network settings-> section hostname/DNS set DNS server you’ve listed in your router/server whatever. Then in route section I set 192.168.1.1 = my router as default route and *enable IP forwarding *on the bottom (or look in the router WAN settings and look up for GW IP and set it as default). Then edit the interfaces in overview section = set your desired static IP for every interface and set if it’d be started at boot, manually cable plugged … 2nd) Bind IP’s to MAC in router settings so you’ll be guaranteed to have the same IP everytime .
Why don’t use** btrfs **it will prevent /hel you out such occasions just set the snapshot before installation of wicd as default and you’'ll roll back to working state = your system will use those settings as it was before installation.
I know that it’s quite simple, but I’ve problem with the gateway I’ve to setup IP forwarding, and I messed it up little bit and desktop won’t boot(it was waiting for mandatory devices as I haven’t set any) so I’ve to edit ifcfg-* files then I found out I can easily set mandatory-device in /etc/sysconfig/network/config . And you everything that can sound simple, is simple can have some little issues