Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: 1 ... 8 9 [10] 11 12 ... 19

Author Topic: Ronski's Pfsense router build  (Read 63776 times)

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #135 on: December 01, 2020, 10:19:43 AM »

Thank you very much for doing that, when I get chance I'll give it go.
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #136 on: January 10, 2021, 11:22:06 AM »

I had completely forgotten about this until this morning.

I done a quick bash script, you can try in shell, not sure if it will work on the default shell that is included with pfsense, 'pkg install bash', should get you bash though.  If you want to the default shell change the first line from bash to sh

Code: [Select]
#!/usr/bin/env bash

wanif=pppoe0
previousip=`cat /tmp/currentip`
ip=`ifconfig $wanif | grep -w inet | awk '{print $2}'`

echo $ip > /tmp/currentip

if [[ "$ip" == "$previousip" ]]; then
exit 0
else
echo "ip has changed from $previousip to $ip"  | /usr/local/bin/mail.php -s"IP changed on pfSense"
fi

run ifconfig first to see which interface has the wan ipv4, set the wanif line to that interface, you then will need to either run the script first to populate the /tmp/currentip file or manually populate it yourself.

I however see no shell command that can be used to send emails hence the commented line, so may need to install a package for that or find a way to use the pfsense mailer system from the cli.

--edit--

I found a way that works, from this post here, so edited the script in post.  This method is nice as it uses the pfSense mailer settings, so wont send e.g. if you disable the mailer in the pfSense GUI.

https://forum.netgate.com/topic/103886/solved-sending-mail-with-pfsense/4

I'm struggling with this, and not really getting anywhere with Googling.

I've installed Bash
I've worked out that em2 is the interface
I've installed Cron

and this is now where I'm struggling, it would appear that cron just runs a command to run the script, rather than entering the script directly into cron.

How do I create the script, and where do I save it?
Once I've done that what command do I enter into cron to run the script?
How do I access the resultant file?

This is really basic stuff in Windows, but it might as well be in Chinese  :wall:
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

broadstairs

  • Kitizen
  • ****
  • Posts: 3697
Re: Ronski's Pfsense router build
« Reply #137 on: January 10, 2021, 11:38:09 AM »

I assume this is Linux or similar, so this article https://www.linux-magazine.com/Issues/2019/225/Command-Line-at-cron-anacron may help. I'm lazy these days and use a GUI Linux system to run cron jobs  ;)

Stuart
Logged
ISP:Vodafone Router:Vodafone Wi-Fi hub FTTP

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #138 on: January 10, 2021, 11:55:29 AM »

Thanks Stuart, yes it's Linux  :( and unfortunately that doesn't help, that seems to focus more on the actual scheduling, which I have worked out. Its creating the script, where to save it, and the commands required to run it from the cron schedule that has me stumped.

Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

broadstairs

  • Kitizen
  • ****
  • Posts: 3697
Re: Ronski's Pfsense router build
« Reply #139 on: January 10, 2021, 12:24:19 PM »

Well initially you can store it anywhere, cron jobs can be run as a user or as root if they need system wide access. I would create it in Linux to eliminate possible issues with line endings. Yes cron executes the schedules the script rather than running it so that's why permissions are important.

Stuart
Logged
ISP:Vodafone Router:Vodafone Wi-Fi hub FTTP

Chrysalis

  • Content Team
  • Addicted Kitizen
  • *
  • Posts: 7382
  • VM Gig1 - AAISP L2TP
Re: Ronski's Pfsense router build
« Reply #140 on: January 16, 2021, 01:55:19 PM »

install nano if it isnt there (text editor), 'pkg install nano'.

or you can create in windows (make sure unix format for file), and then upload it.

To setup the cron there is a cron package inside the package manager, after that is installed, can add to that.

example line for cron for hourly. (although the ui cron package I think makes this easier).  Assuming script is called ipcheck.sh and is located in /root path.

0 * * * * root /root/ipcheck.sh

That line would be pasted in /etc/crontab

However the way I suggest is install the cron package, and then in "services -> cron" menu it is accessible.

in the ui set minute to anything from 0-59 (the time past the hour to run) and in the hour, day, day of week, day of month boxes put * in each one. user as root, and path to script in bottom box.

Also 'chmod 700 /root/ipcheck.sh' to make script executable. That should be fine if it is owned as root, chmod 755 will also work although less secure, but given pfsense is usually not a multiuser system it probably isnt a concern.
« Last Edit: January 16, 2021, 02:05:09 PM by Chrysalis »
Logged

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #141 on: January 16, 2021, 03:49:39 PM »

Thanks Chrysalis, that was so easy, knew it would be just couldn't think how to do it, thank you.

Running the script manually from within pfSense (Diagnostics / Command Prompt) it works perfectly, I've manually edited ipcheck.sh to the wrong IP address and I'll see if it works at 16:00

Thank you again.
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #142 on: January 16, 2021, 05:10:32 PM »

It didn't work at 16:00, but I think I incorrectly put 'chmod 700 /root/ipcheck.sh' as the command, once changed to '/root/ipcheck.sh' it works fine.

I've no real idea what chmod 700 does, from googling seems to be some sort of file protection options, but I did enter "chmod 700 /root/ipcheck.sh" from Diagnostics / Command Prompt page within pfSense so perhaps that did something first, then when that didn't appear to do anything I'd tried just  /root/ipcheck.sh

Anyway all seems to be working now.
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

Chrysalis

  • Content Team
  • Addicted Kitizen
  • *
  • Posts: 7382
  • VM Gig1 - AAISP L2TP
Re: Ronski's Pfsense router build
« Reply #143 on: January 16, 2021, 05:49:54 PM »

glad its working :)

unix permission system applies permissions based on the total sum of the digit.

1 execute
2 write
4 read

so 7 is everything, 6 would be read+write, 5 read+execute.
The first digit is for owner of file, second digit is for group owner of file, third digit is for all users (global).
Logged

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #144 on: August 19, 2023, 11:33:53 AM »

After all theses years my  Qotom Q190G4-S02 Mini PC seems to be dead.

Had some weird power outage on my UPS last night, batteries had been out of it for weeks as they are subject to warranty claim, and being a APC Smart 1500 UPS it will pass through power. Anyway the UPS shut down, no idea why, got it back up and running, but just couldn't connect to Pfsense, so as it was gone midnight I switched the Virgin hum back to router mode.

I've investigated this morning, and although the Qotom powers up, there is no VGA output, and when I connect a network cable, the laptop shows its connected at 10Mbps, yes ten.

What would be a suitable replacement?

 I'd prefer something with 2.5Gbps or faster ports for future proofing, but not totally necessary as those speeds are probably still a long way off.
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #145 on: August 19, 2023, 02:33:55 PM »

« Last Edit: August 19, 2023, 03:17:19 PM by Ronski »
Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

Chrysalis

  • Content Team
  • Addicted Kitizen
  • *
  • Posts: 7382
  • VM Gig1 - AAISP L2TP
Re: Ronski's Pfsense router build
« Reply #146 on: August 19, 2023, 11:41:22 PM »

Sounds like the board has had some kind of failure.

I would be inclined to get the beefier model. you dont want to end up CPU bottlenecked with the fast internet connectivity we have now days.

I did suggest this one to a friend. Which is in between.  But weaker than my current NUC (on a per core basis)

https://www.aliexpress.com/item/1005005848576712.html

The N100 is easily better than my current CPU, so I think thats a pretty good find, and considering current PC tech inflation isnt a bad price.  I am tempted myself, is a good way to upgrade my firewall to 2.5G and power saving and CPU upgrade all at once.

The issue is if you want them to add ram you are forced to take an inclusive SSD as well and 8 gig is the lowest ram on offer, so quite a buff to the price.
« Last Edit: August 19, 2023, 11:43:43 PM by Chrysalis »
Logged

Alex Atkin UK

  • Addicted Kitizen
  • *****
  • Posts: 5260
    • Thinkbroadband Quality Monitors
Re: Ronski's Pfsense router build
« Reply #147 on: August 20, 2023, 04:41:40 AM »

The N5105 seems to top out on OpenVPN at about 600Mbit but can do 2.5Gbit plain NAT from the reviews I saw.

Never figured out what the PPP overhead is as it shows up oddly in the process list, never seems to use much CPU which can't be right when pulling Gigabit.  Then again, they're not exactly slow cores so who knows.  Few people review these units, none use PPP that I found.

What's really impressive is it spends most of it times pulling 11W, which is comparable to a consumer router albeit because those have WiFi and the internal switch to power too.
« Last Edit: August 20, 2023, 04:44:22 AM by Alex Atkin UK »
Logged
Broadband: Zen Full Fibre 900 + Three 5G Routers: pfSense (Intel N100) + Huawei CPE Pro 2 H122-373 WiFi: Zyxel NWA210AX
Switches: Netgear MS510TXUP, Netgear MS510TXPP, Netgear GS110EMX My Broadband History & Ping Monitors

Ronski

  • Helpful
  • Kitizen
  • *
  • Posts: 4300
Re: Ronski's Pfsense router build
« Reply #148 on: August 20, 2023, 10:21:18 AM »

Thanks guys, do you think there is any need to go for the i3 N305, its quite a bit more expensive, and I think will use a little more power but not much, but so much more powerful.

https://www.servethehome.com/almost-a-decade-in-the-making-our-fanless-intel-i3-n305-2-5gbe-firewall-review/

Logged
Formerly restrained by ECI and ali,  now surfing along at 390/36  ;D

Chrysalis

  • Content Team
  • Addicted Kitizen
  • *
  • Posts: 7382
  • VM Gig1 - AAISP L2TP
Re: Ronski's Pfsense router build
« Reply #149 on: August 20, 2023, 12:58:02 PM »

I checked it, personally dont think its worth the cost difference.  A firewall doesnt need 8 threads.  Thats my 5 pence on it.
Logged
Pages: 1 ... 8 9 [10] 11 12 ... 19