Find the answer to your Linux question:
Results 1 to 4 of 4
Hi everyone, I'm working with Arch Linux for the first time. I am pretty good with ubuntu, backtrack and the normal linux terminal. I have a problem with my network ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2013
    Location
    The Netherlands
    Posts
    2

    Post Script for auto network configuration


    Hi everyone,

    I'm working with Arch Linux for the first time. I am pretty good with ubuntu, backtrack and the normal linux terminal.

    I have a problem with my network configuration.
    According to this page:
    wiki.archlinux.org/index.php/Beginners%27_Guide#Wired
    (I am working with a wired connection)

    I need to run a few commands to get my internet and network working but when I reboot the system it forgot those steps:

    Code:
    systemctl stop dhcpcd.service
    Code:
    ip addr add 10.0.2.0/24 dev enp0s3
    Code:
    ip route add default via 10.0.2.2
    I didn't wanted to type those commands every single time when I booted up the system so I thought I make a script for that:

    Code:
    systemctl stop dhcpcd.service
    ip addr add 10.0.2.0/24 dev enp0s3
    ip route add default via 10.0.2.2
    But when I execute it I get this:
    Error from script.jpg

    So does anyone know how I can make a script that do those commands?

    I'm working in a virtualbox btw.

    Android

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Hello and welcome!

    Do you make that file in Windows and then copy it over? To check, try this command:

    Code:
    cat -v /path/to/network-config.sh
    If you see ^M characters at the end of each line, then you probably need to remove them. You can do it w/awk, sed, etc., but here's an easy way:

    Code:
    dos2unix network-config.sh
    It will replace the input file with the new one, with CR (Carriage Return) chars removed.

    As to your original question, I've never used Arch, but on Fedora, I wanted to use the ip util, instead of ifconfig in my initscripts, so I had to install the etcnet package, which is designed with this in mind. It worked great for me. It was a couple years ago though, so maybe there is something better (or more Arch-specific) than that now.

  3. #3
    Just Joined!
    Join Date
    Apr 2013
    Location
    The Netherlands
    Posts
    2
    Quote Originally Posted by atreyu View Post
    Hello and welcome!

    Do you make that file in Windows and then copy it over? To check, try this command:

    Code:
    cat -v /path/to/network-config.sh
    If you see ^M characters at the end of each line, then you probably need to remove them. You can do it w/awk, sed, etc., but here's an easy way:

    Code:
    dos2unix network-config.sh
    It will replace the input file with the new one, with CR (Carriage Return) chars removed.

    As to your original question, I've never used Arch, but on Fedora, I wanted to use the ip util, instead of ifconfig in my initscripts, so I had to install the package, which is designed with this in mind. It worked great for me. It was a couple years ago though, so maybe there is something better (or more Arch-specific) than that now.
    Ah thanks atreyu this worked for me. Didn't know that windows put ^M at the end of every line. But now I know how to fix it thanks

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    cheers!

    Are you still having the other problem - sorting out the auto-configuration of your network?

    Edit: never mind, i see the thread has been closed. Well, if you do need help w/it, just start a new thread.
    Last edited by atreyu; 04-13-2013 at 02:41 AM. Reason: see Edit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •